You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Peppler <mp...@peppler.org> on 2003/12/13 00:24:56 UTC

[mp2] CGI.pm patch

I ran into the same (or a similar) problem that Scott Beuker reported
with CGI.pm truncating POST content in an mp2 setup. In my case the POST
was truncated at around 7500 bytes. A check with tcpdump shows that the
entire POST is correctly sent to apache.

I started by upgrading CGI.pm to the latest release (3.01), but that
didn't fix it.

Looking through the archives I saw a patch posted by Stas. Here's my
version of that patch, that appears to fix that problem.

*** CGI.pm~ 2003-12-12 15:09:45.000000000 -0800
--- CGI.pm 2003-12-12 15:12:29.000000000 -0800
***************
*** 551,558 ****
        }
   
        if ($meth eq 'POST') {
!    $self->read_from_client(\$query_string,$content_length,0)
!        if $content_length > 0;
     # Some people want to have their cake and eat it too!
     # Uncomment this line to have the contents of the query string
     # APPENDED to the POST data.
--- 551,565 ----
        }
   
        if ($meth eq 'POST') {
!  if($content_length > 0) {
!    my $len = $content_length;
!    while ($len > 0) {
!      my $data = '';
!             my $read =
$self->read_from_client(\$data,$content_length,0);
!      $len -= $read;
!      $query_string .= $data if $read > 0;
!    }
!  }
     # Some people want to have their cake and eat it too!
     # Uncomment this line to have the contents of the query string
     # APPENDED to the POST data.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: [mp2] CGI.pm patch

Posted by Stas Bekman <st...@stason.org>.
Michael Peppler wrote:
> I ran into the same (or a similar) problem that Scott Beuker reported
> with CGI.pm truncating POST content in an mp2 setup. In my case the POST
> was truncated at around 7500 bytes. A check with tcpdump shows that the
> entire POST is correctly sent to apache.
> 
> I started by upgrading CGI.pm to the latest release (3.01), but that
> didn't fix it.

Yes, but you also need the latest mp2. There was a bug both in mp2 and CGI.pm. 
Both fixed in the latest versions.


modperl-2.0/Changes:

=item 1.99_11 - November 10, 2003

[...]

rewrite $r->read() and perlio read functions to use the same function,
which completely satisfies the read request if possible, on the way
getting rid of get_client_block and its supporting functions which
have problems and will most likely will be removed from the httpd-API
in the future. Directly manipulate bucket brigades instead. [Stas]

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html