OK, I've traced through stuff.  The current proposed fix will break the 
ability to read and write CGI state to temporary files, database handles, etc 
when operating under mod_perl.  Possibly some of the persistent state engines 
use this, but I think I'll leave it as a known bug.

Lincoln

On Monday 03 November 2003 08:08 pm, Stas Bekman wrote:
> --- 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

-- 
Lincoln Stein
[EMAIL PROTECTED]
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724
(516) 367-8380 (voice)
(516) 367-8389 (fax)

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

Reply via email to