I've reverted and patched, looks good. No issues so far as I can
see, the clients that were affected before are still working fine.

Thanks,
Scott Beuker

> -----Original Message-----
> From: Stas Bekman [mailto:[EMAIL PROTECTED]
> Sent: November 3, 2003 6:08 PM
> To: mod_perl Mailing List; Scott Beuker; Lincoln Stein
> Subject: [patch CGI.pm] fix the read() POST requests under 'SetHandler
> modperl'
> 
> 
> Unrelated to the issue with PerlIO blocking read that will be 
> resolved 
> shortly, CGI.pm has a problem working under mod_perl 2's 
> 'SetHandler modperl' 
> mode, when you can't do:
> 
>    read(STDIN, ....);
> 
> because STDIN is not "connected" to the client's socket. 
> Therefore CGI.pm must 
> always use $self->r->read() under mod_perl which will work 
> with 'SetHandler 
> modperl' and 'SetHandler perl-script', because the latter makes 
> Apache->request available.
> 
> Please test your applications with this patch, especially 
> mod_perl 1.0 apps 
> that process POST requests, as our mp1 test suite is very incomplete.
> 
> Scott, please revert the patch I've sent earlier and try this 
> one instead.
> 
> Lincoln, please see XXX at the end of the patch. Is it safe 
> to assume that 
> read_from_client always reads from STDIN? I haven't traced 
> all possible calls 
> of this method.
> 
> --- CGI.pm.orig       2003-11-03 15:57:01.000000000 -0800
> +++ CGI.pm    2003-11-03 16:49:17.000000000 -0800
> @@ -19,7 +19,7 @@
>   #   http://stein.cshl.org/WWW/software/CGI/
> 
>   $CGI::revision = '$Id: CGI.pm,v 1.130 2003/08/01 14:39:17 
> lstein Exp $ + 
> patches by merlyn';
> -$CGI::VERSION='3.00';
> +$CGI::VERSION='3.01';
> 
>   # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
>   # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING.
> @@ -447,7 +447,11 @@
>       # quietly read and discard the post
>         my $buffer;
>         my $max = $content_length;
> -       while ($max > 0 && (my $bytes = 
> read(STDIN,$buffer,$max < 10000 ? $max : 
> 10000))) {
> +       while ($max > 0 &&
> +                 (my $bytes = $MOD_PERL
> +                  ? $self->r->read($buffer,$max < 10000 ? 
> $max : 10000)
> +                  : read(STDIN,$buffer,$max < 10000 ? $max : 10000)
> +                 )) {
>           $max -= $bytes;
>         }
>         $self->cgi_error("413 Request entity too large");
> @@ -834,7 +838,11 @@
>       my($self, $fh, $buff, $len, $offset) = @_;
>       local $^W=0;                # prevent a warning
>       return undef unless defined($fh);
> -    return read($fh, $$buff, $len, $offset);
> +    # XXX: what if $fh is not STDIN? but doesn't read_from_client,
> +    # imply STDIN?
> +    return $MOD_PERL
> +        ? $self->r->read($$buff, $len, $offset)
> +        : read($fh, $$buff, $len, $offset);
>   }
>   END_OF_FUNC
> 
> 

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

Reply via email to