Hey Chris,
My version of UserAgent.pm has redirect_ok returning a 0
if the method is POST, do you know why this is in the default
behavior? I've been having trouble getting https to work with multiple
redirects and this may relate to that, just wondering why it defaults
to saying you cannot redirect a POST method.
Thanks,
Tony
>
> In addition, I found that to mimic the behavior of web browsers on
> sites that do multiple redirects, I had to enable redirects for the
> POST method __AND__ when this occurrs, change the request method to
> GET. (It took a lot of headaches to figure that one out ;) Here's
> some more code :
>
>
> # We need to subclass LWP::UserAgent in order to allow redirects on POSTS
> # and fix some other problems. In other words, to make it behave like a
> # 'real' web browser
> @MyAgent::ISA = qw(LWP::UserAgent);
> sub MyAgent::redirect_ok {
> my ($self,$request)=@_;
>
> # *****************************************************
> # IMPORTANT:
> #
> # POSTs that get redirected __MUST__ change the request
> # method to GET!!!!
> # *****************************************************
> if ($request->method eq "POST") {
> $request->method("GET");
> }
> return 1;
> }