"Marvin Simkin" <[EMAIL PROTECTED]> writes:
> Gosh it's so easy to offer a solution if you don't go to the bother
> of actually writing code...
>
> My thought is, the "request" object should consist of not just the
> URL, but the entire collection of headers that were sent to the
> server. Thus request 1 to URL "A" has no cookie. Request 2 to URL
> "B" gets issued a cookie and is redirected to URL "A". Request 3 to
> URL "A" **does** have a cookie, thus it is not equal to request 1,
> thus no loop has occurred.
The problem for LWP is that the cookie header has not yet been set up
at the place which do the redirect check (at least if you let LWP deal
with cookies by setting the $ua->cookie_jar attribute).
One way to deal with this is to just simplify the loop check so that
it simply allows a given number of redirects before giving up. This
will make LWP slower at detecting loops, but should avoid your
problem. I don't think redirect loops are so common that this should
actually be a problem.
> And then to make this solution nasty, I've seen broken sites that
> **do** keep redirecting you in circles, changing the cookie value or
> even an URL parameter, but returning to the same base URL over and
> over and over... Humans can get tired of waiting and hit stop, but
> to a robot this would be a black hole. There's a lot of defective
> crud out there.
We have a loop counter to help us here.
Regards,
Gisle