Re: APR::Request::Apache2 param() method

2007-01-31 Thread Joe Schaefer
Dave Viner <[EMAIL PROTECTED]> writes:

> removing the enctype makes no difference.  still encounter the same error.

OK, I think we're getting somewhere now.
Are you using code that calls CGI.pm from
a different handler (say in the auth phase)?

-- 
Joe Schaefer


Re: APR::Request::Apache2 param() method

2007-01-31 Thread Dave Viner
removing the enctype makes no difference.  still encounter the same  
error.


i also added discard_request_body...  the code now reads:

my $req = APR::Request::Apache2->handle($r);
$r->discard_request_body;
my($arg_status,$body_status) = $req->param_status();
$r->log->debug("Parsing returned $arg_status, $body_status");  
#this is line 43


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");



here's the output in the error log:

[Wed Jan 31 13:17:32 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.
[Wed Jan 31 13:17:32 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]
[Wed Jan 31 13:17:32 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]
[Wed Jan 31 13:17:32 2007] [warn] [client 127.0.0.1] no alert id  
given, referer: http://lalala.aboutmybaby.localhost/mailing_list/ 
[EMAIL PROTECTED]



I also tried to verify my sanity by using CGI.pm to print out what  
the parameters are that are received...

here's that output and code:

[Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ 
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(18): [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 44.
[Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ 
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(44): [client  
127.0.0.1] Parsing returned Missing input data, , referer: http:// 
lalala.aboutmybaby.localhost/mailing_list/remove? 
[EMAIL PROTECTED]
[Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI]  
alerts_id => 44524, referer: http://lalala.aboutmybaby.localhost/ 
mailing_list/[EMAIL PROTECTED]
[Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI]  
alerts_email => [EMAIL PROTECTED], referer: http:// 
lalala.aboutmybaby.localhost/mailing_list/remove? 
[EMAIL PROTECTED]
[Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] Got [CGI] submit  
=> Remove, referer: http://lalala.aboutmybaby.localhost/mailing_list/ 
[EMAIL PROTECTED]
[Wed Jan 31 13:23:30 2007] [debug] /Users/dviner/Documents/amb/dev/ 
aboutmybaby/AMB/Handlers/MailingList/Remove.pm(62): [client  
127.0.0.1]  Checking params, referer: http:// 
lalala.aboutmybaby.localhost/mailing_list/remove? 
[EMAIL PROTECTED]
[Wed Jan 31 13:23:30 2007] [warn] [client 127.0.0.1] no alert id  
given, referer: http://lalala.aboutmybaby.localhost/mailing_list/ 
[EMAIL PROTECTED]


CODE:

my $req = APR::Request::Apache2->handle($r);
$r->discard_request_body;
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 [APR::Request::Apache2] $k => " . $ps- 
>{$k});

}
my $cgi = CGI->new($r);
my $pscgi = $cgi->Vars();
foreach my $k (keys(%$pscgi))
{
$r->log->warn("Got [CGI] $k => " . $pscgi->{$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");


How is it that CGI.pm finds the parameter and APR::Request::Apache2  
does not??


thanks
dave




On Jan 30, 2007, at 12:49 PM, Joe Schaefer wrote:


Dave Viner <[EMAIL PROTECTED]> writes:


Hi,

I am having a strange problem with APR::Request::Apache2 and the  
param
() method.  When I send a POST from Firefox, my code work

Re: APR::Request::Apache2 param() method

2007-01-30 Thread Joe Schaefer
Dave Viner <[EMAIL PROTECTED]> writes:

> 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:
>  enctype="multipart/form-data">
  

Have you tried it with the default enctype?

> 
> 
> 
>  onclick="document.location='/'; return false;">
> 
> 
>
> Here is the Perl code which handles this request:
>
> my $req = APR::Request::Apache2->handle($r);

Try adding

  $r->discard_request_body;

here, and then see what the body_status is.
(The code didn't croak, so I don't think you're getting
an error, but let's see anyhow).

-- 
Joe Schaefer