Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

missing POST data but not GET.....

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


j_lalith at yahoo

May 13, 2008, 7:13 PM

Post #1 of 8 (677 views)
Permalink
missing POST data but not GET.....

Hi,

we have mod_perl auth handler

if the form(html) sumission is GET the sumitted data is avaible insid the
mod_perl auth handler and also after that.

But strange this is if the form submission is Post the data is available
with the mod_perl handler but not after that, After the
execution of the auth hanlder the post data is lost,

Is this kind of a bug or any configuration issue?

Waiting for a early reply

Thanks

--
View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17222133.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


drfrench at gmail

May 13, 2008, 11:20 PM

Post #2 of 8 (658 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

Hi,

POST data is read directly from the socket and can only be read once.
You must save the POST'd data in a data structure that is passed or
available to the different handlers in order to access it multiple
times.

Here is a good explanation of the process, they use a different method
than the one I describe but it also works:

http://modperlbook.org/html/A-2-Reusing-Data-from-POST-Requests.html

Rgrds,
Rob

On Tue, May 13, 2008 at 7:13 PM, Tracy12 <j_lalith[at]yahoo.com> wrote:
>
> Hi,
>
> we have mod_perl auth handler
>
> if the form(html) sumission is GET the sumitted data is avaible insid the
> mod_perl auth handler and also after that.
>
> But strange this is if the form submission is Post the data is available
> with the mod_perl handler but not after that, After the
> execution of the auth hanlder the post data is lost,
>
> Is this kind of a bug or any configuration issue?
>
> Waiting for a early reply
>
> Thanks
>
> --
> View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17222133.html
> Sent from the mod_perl - General mailing list archive at Nabble.com.
>
>


joe_schaefer at yahoo

May 14, 2008, 3:53 PM

Post #3 of 8 (643 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

--- Rob French <drfrench[at]gmail.com> wrote:

> Hi,
>
> POST data is read directly from the socket and can
> only be read once.

No. POST data is read through httpd's filter api.
How many times you can read it depends on what's in
the input filter chain.

The original poster should be using apreq
(APR::Request::Apache2 or Apache2::Request)
for this, not some other perl module that doesn't
exploit the filter api.


j_lalith at yahoo

May 14, 2008, 6:38 PM

Post #4 of 8 (639 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

Hi,

Thanks for the reply,

Can you pls clariy what is meant by the following,

>>
>>The original poster should be using apreq
>>(APR::Request::Apache2 or Apache2::Request)
>>for this, not some other perl module that doesn't
>>exploit the filter api.

Does this mean the final target application which consumes POST data should
use Apache2::Request or the Auth handler should should do "SOMETHING " to
preserve data using Apache2::Request. At the moment I am not doing any
specific request handling.

at the moment I have sample CGI script writen in perl which get the request
parameter. as follows,
Are you saying that I should use Apache2::Request in the following instead
of use CGI qw(:standard) , pls clarify

#!/usr/bin/perl
use warnings;
use strict;
use CGI qw(:standard);

my $username = param('code') || "unknown";
printf "Content-type: text/html\r\n\r\n";
printf "<P>Hello, World. $username";

for more information I will state the top part of my Auth Handler. As you
can see I am using Apache2::compat as I got old api calls as well.

package AuthCAS;

use strict;
use vars qw( $VERSION);
$VERSION = '1.1';
my @ISA = qw(Exporter);
my @EXPORT = qw($errors);
my $errors;

use Carp;
use Apache2::compat;
use CGI;
use CGI::Session;
use CGI::Cookie;
use Apache::Constants ':common';
use Apache::Constants qw(HTTP_MOVED_TEMPORARILY);
use Apache::Constants qw(M_GET OK DECLINED);
....
....








--
View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17244429.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


joe_schaefer at yahoo

May 14, 2008, 6:44 PM

Post #5 of 8 (642 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

--- Tracy12 <j_lalith[at]yahoo.com> wrote:

>
> Hi,
>
> Thanks for the reply,
>
> Can you pls clariy what is meant by the following,
>
> >>
> >>The original poster should be using apreq
> >>(APR::Request::Apache2 or Apache2::Request)
> >>for this, not some other perl module that doesn't
> >>exploit the filter api.
>
> Does this mean the final target application which
> consumes POST data should
> use Apache2::Request

You could, but it's not necessary.

> or the Auth handler should
> should do "SOMETHING " to
> preserve data using Apache2::Request.

Use Apache2::Request in the auth handler, and apreq
will do the SOMETHING you need automatically.


> At the moment
> I am not doing any
> specific request handling.
>
> at the moment I have sample CGI script writen in
> perl which get the request
> parameter. as follows,
> Are you saying that I should use Apache2::Request in
> the following instead
> of use CGI qw(:standard) , pls clarify
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> use CGI qw(:standard);
>
> my $username = param('code') || "unknown";
> printf "Content-type: text/html\r\n\r\n";
> printf "<P>Hello, World. $username";
>
> for more information I will state the top part of my
> Auth Handler. As you
> can see I am using Apache2::compat as I got old api
> calls as well.
>
> package AuthCAS;
>
> use strict;
> use vars qw( $VERSION);
> $VERSION = '1.1';
> my @ISA = qw(Exporter);
> my @EXPORT = qw($errors);
> my $errors;
>
> use Carp;
> use Apache2::compat;
> use CGI;
> use CGI::Session;
> use CGI::Cookie;

If you can drop the CGI:: modules and use
Apache2::Request and Apache2::Cookie instead,
it'll just work. By default, using apreq in
an auth handler will preserve the POST data
within the input filter chain for your
content handler to use as it sees fit. You
don't necessarily need to use apreq in your
content handler for things to work right.
For all apreq cares, your content handler
could be a cgi script written in python.


j_lalith at yahoo

May 14, 2008, 9:17 PM

Post #6 of 8 (636 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

Thanks for the reply,

instead of rewriting the CGI used locations isn't there a way to get the
functionality.

I am making use of $r primary for some session handling only. I am not doing
any read or manipulation with the POSTed data.

Do you think that CGI removal is a must?

Without much rework can't get the Apache2::Request to work. At this stage I
prefer less code change as every other fuctionality is working.

Would just a initialization of following work,

my $req = Apache2::Request->new($r);

Thanks

Joe Schaefer-6 wrote:
>
> --- Tracy12 <j_lalith[at]yahoo.com> wrote:
>
>>
>> Hi,
>>
>> Thanks for the reply,
>>
>> Can you pls clariy what is meant by the following,
>>
>> >>
>> >>The original poster should be using apreq
>> >>(APR::Request::Apache2 or Apache2::Request)
>> >>for this, not some other perl module that doesn't
>> >>exploit the filter api.
>>
>> Does this mean the final target application which
>> consumes POST data should
>> use Apache2::Request
>
> You could, but it's not necessary.
>
>> or the Auth handler should
>> should do "SOMETHING " to
>> preserve data using Apache2::Request.
>
> Use Apache2::Request in the auth handler, and apreq
> will do the SOMETHING you need automatically.
>
>
>> At the moment
>> I am not doing any
>> specific request handling.
>>
>> at the moment I have sample CGI script writen in
>> perl which get the request
>> parameter. as follows,
>> Are you saying that I should use Apache2::Request in
>> the following instead
>> of use CGI qw(:standard) , pls clarify
>>
>> #!/usr/bin/perl
>> use warnings;
>> use strict;
>> use CGI qw(:standard);
>>
>> my $username = param('code') || "unknown";
>> printf "Content-type: text/html\r\n\r\n";
>> printf "<P>Hello, World. $username";
>>
>> for more information I will state the top part of my
>> Auth Handler. As you
>> can see I am using Apache2::compat as I got old api
>> calls as well.
>>
>> package AuthCAS;
>>
>> use strict;
>> use vars qw( $VERSION);
>> $VERSION = '1.1';
>> my @ISA = qw(Exporter);
>> my @EXPORT = qw($errors);
>> my $errors;
>>
>> use Carp;
>> use Apache2::compat;
>> use CGI;
>> use CGI::Session;
>> use CGI::Cookie;
>
> If you can drop the CGI:: modules and use
> Apache2::Request and Apache2::Cookie instead,
> it'll just work. By default, using apreq in
> an auth handler will preserve the POST data
> within the input filter chain for your
> content handler to use as it sees fit. You
> don't necessarily need to use apreq in your
> content handler for things to work right.
> For all apreq cares, your content handler
> could be a cgi script written in python.
>
>
>
>
>
>
>
>

--
View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17245705.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


j_lalith at yahoo

May 15, 2008, 11:14 PM

Post #7 of 8 (609 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

Yes this works with no issues, keeping the existing code untouched

Thanks


robf-3 wrote:
>
> Hi,
>
> POST data is read directly from the socket and can only be read once.
> You must save the POST'd data in a data structure that is passed or
> available to the different handlers in order to access it multiple
> times.
>
> Here is a good explanation of the process, they use a different method
> than the one I describe but it also works:
>
> http://modperlbook.org/html/A-2-Reusing-Data-from-POST-Requests.html
>
> Rgrds,
> Rob
>
> On Tue, May 13, 2008 at 7:13 PM, Tracy12 <j_lalith[at]yahoo.com> wrote:
>>
>> Hi,
>>
>> we have mod_perl auth handler
>>
>> if the form(html) sumission is GET the sumitted data is avaible insid
>> the
>> mod_perl auth handler and also after that.
>>
>> But strange this is if the form submission is Post the data is available
>> with the mod_perl handler but not after that, After the
>> execution of the auth hanlder the post data is lost,
>>
>> Is this kind of a bug or any configuration issue?
>>
>> Waiting for a early reply
>>
>> Thanks
>>
>> --
>> View this message in context:
>> http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17222133.html
>> Sent from the mod_perl - General mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17268278.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


j_lalith at yahoo

May 23, 2008, 12:26 AM

Post #8 of 8 (449 views)
Permalink
Re: missing POST data but not GET..... [In reply to]

I removed the mp1 codes,

Also used Apache2 cookie, but still the post data is not there but still I
am using CGI session.
Should I use some other session handling...

How can I make sure that my $r is a Apache2 request.

Do I have to do as follows and use $req for all the references e.g setting
remote user variables etc
my $req = Apache2::Request->new($r, POST_MAX => "1M");

waiting for a quick reply. pls advice

I have the following use statements and not refering to any mp1 code

use CGI;
use CGI::Session;

use Apache2::ServerUtil;
use Apache2::Request;
use Apache2::URI;
use Apache2::Cookie;
use Apache2::Log;
use APR::URI ;









Joe Schaefer-6 wrote:
>
>
> --- Rob French <drfrench[at]gmail.com> wrote:
>
>> Hi,
>>
>> POST data is read directly from the socket and can
>> only be read once.
>
> No. POST data is read through httpd's filter api.
> How many times you can read it depends on what's in
> the input filter chain.
>
> The original poster should be using apreq
> (APR::Request::Apache2 or Apache2::Request)
> for this, not some other perl module that doesn't
> exploit the filter api.
>
>
>
>
>
>

--
View this message in context: http://www.nabble.com/missing-POST-data-but-not-GET.....-tp17222133p17419769.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.