I have included the diffs for my fixed version below.  If you want them
in another format, let me know.  I think it would be pretty cool to have
a bug fix of mine make it into the main distribution!

125,133c125,134
<               'agent'       => "libwww-perl/$LWP::VERSION",
<               'from'        => undef,
<               'timeout'     => 3*60,
<               'proxy'       => undef,
<               'cookie_jar'  => undef,
<               'use_eval'    => 1,
<                 'parse_head'  => 1,
<                 'max_size'    => undef,
<               'no_proxy'    => [],
---
>               'agent'                => "libwww-perl/$LWP::VERSION",
>               'from'                 => undef,
>               'timeout'              => 3*60,
>                 'check_redirect_loops' => 1,
>               'proxy'                => undef,
>               'cookie_jar'           => undef,
>               'use_eval'             => 1,
>                 'parse_head'           => 1,
>                 'max_size'             => undef,
>               'no_proxy'             => [],
279,281c280,283
<       my $count = 0;
<       my $r = $response;
<       while ($r) {
---
>       if ($self->{'check_redirect_loops'}) {
>           my $count = 0;
>           my $r = $response;
>           while ($r) {
284,286c286,288
<               $response->header("Client-Warning" =>
<                                 "Redirect loop detected");
<               return $response;
---
>               $response->header("Client-Warning" =>
>                                 "Redirect loop detected");
>               return $response;
289c291,292
<       }
---
>           }
>         }
442a446,450
> =item $ua->check_redirect_loops([$boolean])
>
> Get/set a value indicating whether we should check for loops when
following
> redirects.  By default loop checking is on.
>
464,469c472,478
< sub timeout    { shift->_elem('timeout',   @_); }
< sub agent      { shift->_elem('agent',     @_); }
< sub from       { shift->_elem('from',      @_); }
< sub cookie_jar { shift->_elem('cookie_jar',@_); }
< sub parse_head { shift->_elem('parse_head',@_); }
< sub max_size   { shift->_elem('max_size',  @_); }
---
> sub timeout               { shift->_elem('timeout',                @_); }
> sub check_redirect_loops  { shift->_elem('check_redirect_loops',   @_); }
> sub agent                 { shift->_elem('agent',                  @_); }
> sub from                  { shift->_elem('from',                   @_); }
> sub cookie_jar            { shift->_elem('cookie_jar',             @_); }
> sub parse_head            { shift->_elem('parse_head',             @_); }
> sub max_size              { shift->_elem('max_size',              @_); }

- Greg


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Gisle
> Aas
> Sent: Friday, February 18, 2000 3:03 PM
> To: Greg White
> Cc: [EMAIL PROTECTED]
> Subject: Re: LWP::UserAgent overly agressive in detecting loops
>
>
> "Greg White" <[EMAIL PROTECTED]> writes:
>
> > Our server redirects (302) the client to a page which sets a cookie
> > and then redirects the client back where they came from.  This works
> > fine with all browsers we have tested against, but not with
> > LWP::UserAgent because it traps for this situation and considers it
> > a redirect loop.
> >
> > We do this as a way to verify that the user is allowing us to set
> > cookies.  If they don't, we want to let them know that they can't
> > proceed.
> >
> > It would be nice if UserAgent had a method which lets users turn the
> > checks for redirect looping on or off.  Right now, it looks like I
> > am going to have to copy the source and make my own version (thanks
> > for making it open source!).
>
> This is a known problem.  If you can come up with a good fix for this
> problem consider sending it to this list so it can be incorporated in
> later LWP versions.
>
> Regards,
> Gisle

Reply via email to