From: Lincoln Stein Date: Thu, 17 Apr 1997 18:22:51 +0000 (+1200) Subject: Refresh CGI.pm to 2.35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47e3cabda9bbdb8cfcaa856cd58b1452b57cb369;p=p5sagit%2Fp5-mst-13.2.git Refresh CGI.pm to 2.35 --- diff --git a/lib/CGI.pm b/lib/CGI.pm index 92c875b..2ae635e 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -28,8 +28,8 @@ $AUTOLOAD_DEBUG=0; # 3) print header(-nph=>1) $NPH=0; -$CGI::revision = '$Id: CGI.pm,v 2.34 1997/4/7 7:23 lstein Exp $'; -$CGI::VERSION='2.3402'; +$CGI::revision = '$Id: CGI.pm,v 2.35 1997/4/20 20:19 lstein Exp $'; +$CGI::VERSION='2.35'; # OVERRIDE THE OS HERE IF CGI.pm GUESSES WRONG # $OS = 'UNIX'; @@ -546,8 +546,6 @@ sub all_parameters { return @{$self->{'.parameters'}}; } - - #### Method as_string # # synonym for "dump" @@ -1018,6 +1016,7 @@ END_OF_FUNC # $xbase -> (optional) alternative base at some remote location (-xbase) # $target -> (optional) target window to load all links into (-target) # $script -> (option) Javascript code (-script) +# $no_script -> (option) Javascript +END + ; my($other) = @other ? " @other" : ''; push(@result,""); return join("\n",@result); @@ -2327,6 +2332,7 @@ sub read_multipart { my(%header,$body); while (!$buffer->eof) { %header = $buffer->readHeader; + die "Malformed multipart POST\n" unless %header; # In beta1 it was "Content-disposition". In beta2 it's "Content-Disposition" # Sheesh. @@ -2465,7 +2471,6 @@ sub new { # Read the topmost (boundary) line plus the CRLF my($null) = ''; $length -= $interface->read_from_client($IN,\$null,length($boundary)+2,0); - } else { # otherwise we find it ourselves my($old); ($old,$/) = ($/,$CRLF); # read a CRLF-delimited line @@ -2494,12 +2499,15 @@ sub readHeader { my($self) = @_; my($end); my($ok) = 0; + my($bad) = 0; do { $self->fillBuffer($FILLUNIT); $ok++ if ($end = index($self->{BUFFER},"${CRLF}${CRLF}")) >= 0; $ok++ if $self->{BUFFER} eq ''; + $bad++ if !$ok && $self->{LENGTH} <= 0; $FILLUNIT *= 2 if length($self->{BUFFER}) >= $FILLUNIT; - } until $ok; + } until $ok || $bad; + return () if $bad; my($header) = substr($self->{BUFFER},0,$end+2); substr($self->{BUFFER},0,$end+4) = ''; @@ -2540,6 +2548,8 @@ sub read { # Find the boundary in the buffer (it may not be there). my $start = index($self->{BUFFER},$self->{BOUNDARY}); + # protect against malformed multipart POST operations + die "Malformed multipart POST\n" unless ($start >= 0) || ($self->{LENGTH} > 0); # If the boundary begins the data, then skip past it # and return undef. The +2 here is a fiendish plot to @@ -2595,7 +2605,7 @@ sub fillBuffer { $bytesToRead, $bufferLength); - # An apparent bug in the Netscape Commerce server causes the read() + # An apparent bug in the Apache server causes the read() # to return zero bytes repeatedly without blocking if the # remote user aborts during a file transfer. I don't know how # they manage this, but the workaround is to abort if we get @@ -2725,7 +2735,10 @@ The current version of CGI.pm is available at http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html ftp://ftp-genome.wi.mit.edu/pub/software/WWW/ -=head1 INSTALLATION: +=head1 INSTALLATION + +CGI is a part of the base Perl installation. However, you may need +to install a newer version someday. Therefore: To install this package, just change to the directory in which this file is found and type the following: @@ -3204,7 +3217,7 @@ There is no support for the HTTP-EQUIV type of tag. This is because you can modify the HTTP header directly with the B method. -JAVASCRIPTING: The B<-script>, B<-onLoad> and B<-onUnload> parameters +JAVASCRIPTING: The B<-script>, B<-noScript>, B<-onLoad> and B<-onUnload> parameters are used to add Netscape JavaScript calls to your pages. B<-script> should point to a block of text containing JavaScript function definitions. This block will be placed within a