perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hakan Nilsson <>
Subject Re: [BUG] Losing GET/POST-data
Date Thu, 03 Oct 2002 13:09:59 GMT
On Wed, 2 Oct 2002, Wes Cravens wrote:

> On 02 Oct 2002 15:23 GMT I wrote:
> >
> > Hi!
> >
> > We're developing a perl module for apache/mod_perl, but have encountered a
> > really strange problem.
> >
> > After 'a while' we seem to lose the data sent to the apache-server, at
> > least it never reaches our module.
> <SNIP>
> > Recently we switched from using the standard Apache request-object to
> > using the Apache::Request one, for the added functionality, but this has
> > not had any effect at all as far as we can tell, and the bug keeps
> > happening...
> I ran into a problem that the param parts of a request were flushed
> when read for the first time... so if you lose them (don't store them)
> then you cannot access them again.

Yep, noticed this myself when re-writing it to check the input, should
have posted this first perhaps, but anyway, this is basically how we
handle the input:

sub handler($)
    $^W = 1; # gripe about the little things
    my $r = shift;
    my %parm;

    if ($r->method() eq 'POST') { %parm = $r->content(); }
    elsif ($r->method() eq 'GET') { %parm = $r->args(); }

<snipped lots of more code>

And now, after the re-write with Apache::Request

sub handler($)
    $^W = 1; # gripe about the little things
    my $r = shift;
    my $apr;
    my %parm;

    $apr = Apache::Request->new($r);

    if($r->method() eq 'POST' || $r->method() eq 'GET')
        my @keys = $apr->param();

        foreach my $key (@keys)
            $parm{$key} = $apr->param($key);

<snip of the same lots of more code>

So.. I can't really see how that would make us lose the parameters,
especially since we doesn't lose them all the time, which was the case
when I tried to get the same value twice...

[Back to Wes]
> If you are not already, then try
> $apr = HTTP::Request->instance($r); instead...

We use ->new now. Since we always only create one instance of it I
thought there was no difference. Is instance known to be safer or so?

Also got the hint that this could somehow be connected to caching, but
since we when we output debug-messages see that handler() is called, with
no parameters in $r, I don't see how this could be. Any comments, and
suggestions of fix if this might be the problem?

Thanks again,


 Hi! I'm a .signature virus!
 Copy me into your .signature file to help me spread!

View raw message