Hi,
I am having a strange problem with APR::Request::Apache2 and the param
() method. When I send a POST from Firefox, my code works
perfectly. When I send a POST from Safari or Windows/IE, my code fails.
Here is the HTML which displays the form to send:
<form name="delete_alert" action="/mailing_list/remove"
method="post" enctype="multipart/form-data">
<input type="hidden" name="alerts_id" value="1234" />
<input type="hidden" name="alerts_email"
value="[EMAIL PROTECTED]">
<input type="submit" name="submit" value="Remove">
<input type="button" name="cancel" value="Cancel"
onclick="document.location='/'; return false;">
<br class="clearing">
</form>
Here is the Perl code which handles this request:
my $req = APR::Request::Apache2->handle($r);
my($arg_status,$body_status) = $req->param_status();
$r->log->debug("Parsing returned $arg_status, $body_status");
if($r->method_number() == Apache2::Const::M_POST)
{
my $ps = $req->param();
foreach my $k (keys(%$ps))
{
$r->log->warn("Got $k => " . $ps->{$k});
}
## verify that we got an alert id
my $alert_id = $req->param('alerts_id');
my $alert_email = $req->param('alerts_email');
$r->log->debug("!!!!!!!!!!!! Checking params");
if(!$alert_id)
{
$r->log->warn("no alert id given");
return show_form($class, $r, $Site, $req, "Must pass a
properly formatted alert id");
}
$r->log->debug("Have a good alert id");
Again, when Firefox sumbits this request, the code works perfectly...
Here's a snippet from the error log showing the statements:
[Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(17): [client
127.0.0.1] using mod_perl handler for removing mailing list, referer:
http://lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
Use of uninitialized value in concatenation (.) or string at /Users/
dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/
Remove.pm line 43.
[Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(43): [client
127.0.0.1] Parsing returned Missing input data, , referer: http://
lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [debug] filter.c(269): [client 127.0.0.1]
prefetching 65536 bytes, referer: http://lalala.aboutmybaby.localhost/
mailing_list/[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got alerts_id =>
44505, referer: http://lalala.aboutmybaby.localhost/mailing_list/
[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got alerts_email
=> [EMAIL PROTECTED], referer: http://lalala.aboutmybaby.localhost/
mailing_list/[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [warn] [client 127.0.0.1] Got submit =>
Remove, referer: http://lalala.aboutmybaby.localhost/mailing_list/
[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(55): [client
127.0.0.1] !!!!!!!!!!!! Checking params, referer: http://
lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
[Tue Jan 30 12:33:43 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(61): [client
127.0.0.1] Have a good alert id, referer: http://
lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
Here's the same request made from Mac/Safari or Win/IE
[Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(17): [client
127.0.0.1] using mod_perl handler for removing mailing list, referer:
http://lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
Use of uninitialized value in concatenation (.) or string at /Users/
dviner/Documents/amb/dev/aboutmybaby/AMB/Handlers/MailingList/
Remove.pm line 43.
[Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(43): [client
127.0.0.1] Parsing returned Missing input data, , referer: http://
lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
[Tue Jan 30 12:34:49 2007] [debug] filter.c(269): [client 127.0.0.1]
prefetching 65536 bytes, referer: http://lalala.aboutmybaby.localhost/
mailing_list/[EMAIL PROTECTED]
[Tue Jan 30 12:34:49 2007] [debug] /Users/dviner/Documents/amb/dev/
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(55): [client
127.0.0.1] !!!!!!!!!!!! Checking params, referer: http://
lalala.aboutmybaby.localhost/mailing_list/remove?
[EMAIL PROTECTED]
[Tue Jan 30 12:34:49 2007] [warn] [client 127.0.0.1] no alert id
given, referer: http://lalala.aboutmybaby.localhost/mailing_list/
[EMAIL PROTECTED]
Any suggestions on how to fix this? My platform is:
[Tue Jan 30 12:33:01 2007] [notice] Apache/2.0.58 (Unix) PHP/5.1.4
DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2 Perl/v5.8.8 configured
-- resuming normal operations
thanks
dave