I have a thorny web problem. I'm using Perl's WWW::Mechanize.
Here is what I *think* is happening:
- 1. I surf along with Mechanize and get to a form page and fill it out. Let's call it form.html.
- 2. the mech submits the form to form.html via POST. At that point, the web server sends back a 302, redirecting my "browser" (the mech) to a "thank you for submitting" confirm.html page.
- 3. the mech chokes because it does what the RFC says - do not change methods on a 302 - so it tries to POST to confirm.html, which only allows GET.
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.