From: | Andrew Speer <andrew.speer [...] isolutions.com.au> |
To: | bug-HTTP-Recorder [...] rt.cpan.org |
Subject: | Small fixes for HTTP::Recorder version 0.02 |
Date: | Sun, 13 Feb 2005 15:25:18 +1030 |
CC: | leira [...] cpan.org |
Linda,
Thank your for writing HTTP::Recorder, and making it publicly available on
CPAN. I saw your article on perl.com and have been playing around with it
recently. I had some problems:
1 .. I noticed that when used with HTTP::Proxy I could not longer login to
some sites, eg Squirrel Mail on my local web host. Looking at the POST data
from login it appears HTTP::Proxy is sending data similar to:
login_username=usename&login_username=1&login_password=****&login_password=1,
eg it was sending "field_name=1" for every field in the POST data. It looks
like the culprit is in the 'unmodify' routine. I have altered it to get rid of
the duplicate fields.
2 .. When it did load the SquirrelMail home page (which is frame based)
HTTP::Recorder did not log the requests for the left and right frame content,
nor any of the css sheets etc. It looks that you did that deliberately, but I
wanted to catch those sort of subrequests, so I added a flag "ignore_referer"
to the constructor, which if set to 1 will catch all subrequests.
3 .. My browser keeps on asking for "favicon.ico", which is logged by
HTTP::Recorder (not so bad in itself), but it is logged before the field
values are recorded by the script, ie the log looks like:
$ua_or->get("http://copper.isolutions.com.au/webmail/src/login.php");
$ua_or->get("http://copper.isolutions.com.au/favicon.ico");
$ua_or->field("just_logged_in", "1");
$ua_or->field("login_username", "username");
$ua_or->field("js_autodetect_results", "1");
$ua_or->field("secretkey", "****");
$ua_or->submit_form(form_number => "1");
WWW::Mechanize then fails because it is trying to plug the field values into
the response object for "favicon.ico", which has no fields.
To get around this I changed your code to log requests *after* sending them,
and then only if the response was successful (well, actually only if there
was no error in the response, redirects count as "not successful").
Attached is a patch which applies all of the above, feel free to apply if you
think they are warranted. I assign any copyrights to the patch over to you.
Thanks again for your code, and hope the above info helps ...
Andrew Speer
Message body is not shown because sender requested not to inline it.