[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: bug with mod_perl and CGI.pm
From:       Lincoln Stein <lstein () cshl ! edu>
Date:       2004-04-30 21:43:37
Message-ID: 200404301743.37169.lstein () cshl ! edu
[Download RAW message or body]

Hi Lan,

Do you think this might be a bug in mod_perl 1.99X?  It is the 
responsibility of mod_perl's CGI compatibility mode to set the CGI 
environment variables.  It doesn't look as though CGI.pm ever tries 
to set CONTENT_LENGTH itself, even when running under mod_perl, but 
relies on mod_perl to do this.  I'm not trying to evade 
responsibility here, but just to understand where this bug report 
should be directed.

Best,

Lincoln

On Wednesday 28 April 2004 10:01 am, Lan Yufeng wrote:
> Hi, father of CGI.pm :)
> I found a problem when using CGI.pm to parse POSTed data passed to
> mod_perl handler: The %ENV{Content-Length} will never get changed,
> which make CGI $query object method param() returned incorrect hash
> data after the 1st post request.
> Here is the script to test:
> -- t/post.t ---->
>
>     use Apache::Test;use Apache::TestUtil;use Apache::TestRequest
> 'POST'; # First post request
>     my $location='/test/post'
>     my $resp = POST $location, Content=>[ name=>'foo',
> title=>'bar',]; # following requests go on.
>     my $resp = POST $location Content=>[ some=>'a long string
> exceeds the content-length of the last request', string=>'another
> string you wont see',];
>     chomp(my $re = $resp->content);
>     ok t_cmp("expected value",$re,"A bug with mod_perl and
> CGI.pm");
>
> --- end ----
> -- codes in a mod_perl reponse handler Apache::Post-->
>
>     my $q = new CGI($r);
>     $r->print($q->Dump);
>     return Apache::OK;
>
> --- end ----
> --- part of httpd.conf ---
>
>     <Location /test/post>
>         SetHandler modperl
>         PerlResponseHandler Apache::Post
>     </Location>
>
> --- end ----
> run script with: "t/TEST  t/post.t -verbose"
> And you will found that only part of the second POST request data
> is dumped by $q->Dump
>
>     * the version of CGI.pm (perl -MCGI -le 'print $CGI::VERSION'):
> 3.05 * the version of Perl (perl -v):  v5.8.0
>      * the name and version of your Web server: Apache 2.0.44 with
> mod_perl 1.99-05
>      * the name and version of the operating system you are using:
> Redhat 8.0
>      * if applicable, the name and version of the browser you are
> using: perl LWP module
>      * a short test script that reproduces the problem (30 lines or
> less): as above.
>
> I just want to use CGI.pm to parse POSTed data from clients in this
> case until I found this problem. I think every time I call "new
> CGI($apache_request_object)", the %ENV{Content-length} needed to
> read data in CGI.pm doesn't get refreshed.
>
> BTW, I can use built-in API "$r->read()" in mod_perl to read
> compelete posted body data and headers.
>
> sincerely yours,

-- 
Lincoln D. Stein
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic