From: Jarkko Hietaniemi Date: Fri, 4 Jul 2003 12:39:20 +0000 (+0000) Subject: Upgrade to CGI.pm 2.97. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c87da1da4f953d5e3fa74ec3075ddaf999e9d1e;p=p5sagit%2Fp5-mst-13.2.git Upgrade to CGI.pm 2.97. p4raw-id: //depot/perl@19984 --- diff --git a/lib/CGI.pm b/lib/CGI.pm index ecdb164..a30bb9e 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -18,8 +18,8 @@ use Carp 'croak'; # The most recent version and complete docs are available at: # http://stein.cshl.org/WWW/software/CGI/ -$CGI::revision = '$Id: CGI.pm,v 1.112 2003/04/28 13:35:56 lstein Exp $'; -$CGI::VERSION='2.93'; +$CGI::revision = '$Id: CGI.pm,v 1.125 2003/06/16 18:54:19 lstein Exp $'; +$CGI::VERSION='2.97'; # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. @@ -221,7 +221,7 @@ if ($needs_binmode) { base body Link nextid title meta kbd start_html end_html input Select option comment charset escapeHTML/], ':html3'=>[qw/div table caption th td TR Tr sup Sub strike applet Param - embed basefont style span layer ilayer font frameset frame script small big/], + embed basefont style span layer ilayer font frameset frame script small big Area Map/], ':html4'=>[qw/abbr acronym bdo col colgroup del fieldset iframe ins label legend noframes noscript object optgroup Q thead tbody tfoot/], @@ -238,7 +238,6 @@ if ($needs_binmode) { remote_user user_name header redirect import_names put Delete Delete_all url_param cgi_error/], ':ssl' => [qw/https/], - ':imagemap' => [qw/Area Map/], ':cgi-lib' => [qw/ReadParse PrintHeader HtmlTop HtmlBot SplitParam Vars/], ':html' => [qw/:html2 :html3 :html4 :netscape/], ':standard' => [qw/:html2 :html3 :html4 :form :cgi/], @@ -445,6 +444,12 @@ sub init { # avoid unreasonably large postings if (($POST_MAX > 0) && ($content_length > $POST_MAX)) { + # quietly read and discard the post + my $buffer; + my $max = $content_length; + while ($max > 0 && (my $bytes = read(STDIN,$buffer,$max < 10000 ? $max : 10000))) { + $max -= $bytes; + } $self->cgi_error("413 Request entity too large"); last METHOD; } @@ -529,7 +534,8 @@ sub init { # YL: Begin Change for XML handler 10/19/2001 if ($meth eq 'POST' && defined($ENV{'CONTENT_TYPE'}) - && $ENV{'CONTENT_TYPE'} !~ m|^application/x-www-form-urlencoded| ) { + && $ENV{'CONTENT_TYPE'} !~ m|^application/x-www-form-urlencoded| + && $ENV{'CONTENT_TYPE'} !~ m|^multipart/form-data| ) { my($param) = 'POSTDATA' ; $self->add_parameter($param) ; push (@{$self->{$param}},$query_string); @@ -662,7 +668,7 @@ sub _make_tag_func { my(\@attr) = make_attributes(\$a,\$q->{'escape'}); \$attr = " \@attr" if \@attr; } else { - unshift \@rest,\$a; + unshift \@rest,\$a if defined \$a; } ); if ($tagname=~/start_(\w+)/i) { @@ -671,8 +677,7 @@ sub _make_tag_func { $func .= qq! return "<\L/$1\E>"; } !; } else { $func .= qq# -\# return \$XHTML ? "\L<$tagname\E\$attr />" : "\L<$tagname\E\$attr>" unless \@_; - return \$XHTML ? "\L<$tagname\E\$attr />" : "\L<$tagname\E\$attr>" unless \@rest && defined(\$rest[0]); + return \$XHTML ? "\L<$tagname\E\$attr />" : "\L<$tagname\E\$attr>" unless \@rest; my(\$tag,\$untag) = ("\L<$tagname\E\$attr>","\L\E"); my \@result = map { "\$tag\$_\$untag" } (ref(\$rest[0]) eq 'ARRAY') ? \@{\$rest[0]} : "\@rest"; @@ -839,8 +844,8 @@ END_OF_FUNC #### sub delete { my($self,@p) = self_or_default(@_); - my($name) = rearrange([NAME],@p); - my @to_delete = ref($name) eq 'ARRAY' ? @$name : ($name); + my(@names) = rearrange([NAME],@p); + my @to_delete = ref($names[0]) eq 'ARRAY' ? @$names[0] : @names; my %to_delete; foreach my $name (@to_delete) { @@ -1051,7 +1056,7 @@ EOF 'delete_all' => <<'EOF', sub delete_all { my($self) = self_or_default(@_); - my @param = $self->param; + my @param = $self->param(); $self->delete(@param); } EOF @@ -1136,12 +1141,12 @@ sub Dump { push(@result,"