trishah has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm trying to log into a site using WWW::Mechanize. When a user enters their log in details they are redirected to another page. At this point in the headers it says :

"HTTP/1.0 302 Found".

I was wondering, how does WWW::Mechanize cope with redirects ?

Any advice would be much appreciated.

Best Regards,
Trish.

Replies are listed 'Best First'.
Re: WWW::Mechanize and 302 redirect
by PodMaster (Abbot) on May 14, 2004 at 10:09 UTC
    WWW::Mechanize deals with redirects exactly as described in the manual (yes the manual) and source. I hope that clears things up.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: WWW::Mechanize and 302 redirect
by saintmike (Vicar) on May 15, 2004 at 00:33 UTC
    WWW::Mechanize goes through great lengths to behave exactly like the majority of browsers regarding redirects.

    As explained in the RFC, it is incorrect for a browser to allow a POST request to be redirected by a 302 server response. Most browsers do it, though, and that's why WWW::Mechanize explicitely allows it via

    push( @{$self->requests_redirectable}, 'POST' );
    although the underlying LWP::UserAgent strictly complies with the standard.