in reply to redirecting, html forms, mechanize
If I understand correctly you want to redirect a POST request as a POST to the other site. This is possible (well, most of it is; I'm not entirely sure about the file fields) but it can be a pain. The last time I did this was about 4 years ago and the different browsers (Safari at least; which IIRC was the only one which followed the HTTP spec strictly) handled this differently.
I'd actually love to help you but it's been long enough that I'd have to do an hour or two of digging and I've got other fish to fry right now. I just wanted you to know that it is possible. But as the kittehs says: yur doin it rong.
You'll need to construct a POST request. Perhaps with HTTP::Request::Common, perhaps there is a way to tease the request out of WWW::Mechanize but you do not want to $mech->submit the request, you want to use its body in a redirected POST which ends up submitted by your user. The file upload fields are the tricky part and you should verify with some object dumps that they are getting loaded into the POST as complete multi-part data. I recommend using a couple of *small* test files like test.txt and test.gif to eyeball. A big gene file or something is going to make visually inspecting the POST a drag.
User -> GET something from your CGI Your CGI -> Construct POST body that Molsurfer accepts -> Give User a POST redirect with the POST body -> Redirect status should be 303, I think (or maybe 302; test on different browsers)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: redirecting, html forms, mechanize
by RobertCraven (Sexton) on Jun 28, 2009 at 23:10 UTC | |
by Your Mother (Archbishop) on Jun 29, 2009 at 00:04 UTC | |
|
Re^2: redirecting, html forms, mechanize
by RobertCraven (Sexton) on Jun 28, 2009 at 01:05 UTC |