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

I have a thorny web problem. I'm using Perl's WWW::Mechanize.

Here is what I *think* is happening:

This is what I think is happening. What I see from WWW::Mechanize after calling $mech->submit on form.html is "Error POSTing confirm.html: Method not allowed at ./some_script.pl line 325"

The mech is behaving properly - according to the RFC, the 302 is not supposed to change method types. However, most client browsers like IE do change to a GET when they're 302'd, and apparently some web servers (IIS?) expect that behavior.

The form(s) on the other end (which I have no control over) work fine in IE, but not via WWW::Mechanize. I can't do anything about the servers.

I don't see a hook to intercept things after doing $mech->submit().

Any ideas?

Messing around with thinks like "push @{ $mech->requests_redirectable }, 'POST';" don't help. Nor does playing with max_redirect or redirect_ok. I need some sort of "do things improperly, because stupid IIS expects everyone to run IE" flag ;)

-Drew

Replies are listed 'Best First'.
Re: WWW::Mechanize & 302/405
by Corion (Patriarch) on Jun 28, 2004 at 08:36 UTC

    I can't easily reproduce your setup, but you might want to make sure that you have the latest versions of both, LWP and WWW::Mechanize, as there were changes that added the GET after POST redirect behaviour "recently (LWP 2.75 I believe).