You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mat <ma...@hotmail.com> on 2002/02/26 14:47:08 UTC

Can't retrieve form params using post methods, $r->notes and Apache::Request

Hi all,
   I have the following configuration.
<Location "/my">
  SetHandler perl-script
  PerlAccessHandler MyCheck
  PerlHandler MyHomePage
</Location>

The PerlAccessHandler checks if the user cookie is valid and set a $r->notes()
entry to pass the user id to the MyHomePage handler which do his work. In the
MyHomePage hanlder i'm using Apache::Request (my $apr = new
Apache::Request($r); ) to get the parameters of the form from which i'm
calling
the handler.

If i put the form method in POST, I can't get any parameters, the form is
reloaded, but if i put the method to GET then everything is fine.

If I use the following configuration
<Location "/my">
  SetHandler perl-script
  PerlHandler MyHomePage
</Location>
and use either the POST or GET for the form everything is fine.

If I put a PerlAccessHandler not using the $r->notes() method then everything
is fine.

So my problem must come from the $r->notes(). Apparently it messes up with the
POST parameters.

Does somebody have an idea why it doesn't work with the POST method ? I've
lost quite a lot of time with that, even if it works with the GET i'd like to
understand.

Regards, 
   Mat

ps: OS: Linux 2.4.14
Apache 1.3.20
mod_perl 1.26
perl 5.6.1

Re: Can't retrieve form params using post methods, $r->notes and Apache::Request

Posted by Perrin Harkins <pe...@elem.com>.
Mat wrote:
> Hi all,
>    I have the following configuration.
> <Location "/my">
>   SetHandler perl-script
>   PerlAccessHandler MyCheck
>   PerlHandler MyHomePage
> </Location>
> 
> The PerlAccessHandler checks if the user cookie is valid and set a $r->notes()
> entry to pass the user id to the MyHomePage handler which do his work. In the
> MyHomePage hanlder i'm using Apache::Request (my $apr = new
> Apache::Request($r); ) to get the parameters of the form from which i'm
> calling
> the handler.
> 
> If i put the form method in POST, I can't get any parameters, the form is
> reloaded, but if i put the method to GET then everything is fine.
> 
> If I use the following configuration
> <Location "/my">
>   SetHandler perl-script
>   PerlHandler MyHomePage
> </Location>
> and use either the POST or GET for the form everything is fine.
> 
> If I put a PerlAccessHandler not using the $r->notes() method then everything
> is fine.
> 
> So my problem must come from the $r->notes(). Apparently it messes up with the
> POST parameters.

That seems pretty unlikely.  Are you sure you're not trying to read the 
POST content twice?  Maybe you're using a module that reads it?

- Perrin