From: Jarkko Hietaniemi Date: Mon, 25 Aug 2003 11:09:49 +0000 (+0000) Subject: Upgrade to CGI.pm 3.00. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cff9980965379582a7e6bc54ef5e679209355670;p=p5sagit%2Fp5-mst-13.2.git Upgrade to CGI.pm 3.00. p4raw-id: //depot/perl@20875 --- diff --git a/lib/CGI.pm b/lib/CGI.pm index 3157400..9f65f7d 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.127 2003/06/18 19:57:21 lstein Exp $'; -$CGI::VERSION='2.98'; +$CGI::revision = '$Id: CGI.pm,v 1.130 2003/08/01 14:39:17 lstein Exp $ + patches by merlyn'; +$CGI::VERSION='3.00'; # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. @@ -1639,12 +1639,11 @@ sub startform { $method = lc($method) || 'post'; $enctype = $enctype || &URL_ENCODED; unless (defined $action) { - $action = $self->url(-absolute=>1,-path=>1); + $action = $self->escapeHTML($self->url(-absolute=>1,-path=>1)); if (length($ENV{QUERY_STRING})>0) { - $action .= "?$ENV{QUERY_STRING}"; + $action .= "?".$self->escapeHTML($ENV{QUERY_STRING},1); } } - $action =~ s/\"/%22/g; # fix cross-site scripting bug reported by obscure $action = qq(action="$action"); my($other) = @other ? " @other" : ''; $self->{'.parametersToAdd'}={}; @@ -3584,10 +3583,12 @@ END_OF_AUTOLOAD #################################################################################### package CGITempFile; -$SL = $CGI::SL; -$MAC = $CGI::OS eq 'MACINTOSH'; -my ($vol) = $MAC ? MacPerl::Volumes() =~ /:(.*)/ : ""; -unless ($TMPDIRECTORY) { +sub find_tempdir { + undef $TMPDIRECTORY; + $SL = $CGI::SL; + $MAC = $CGI::OS eq 'MACINTOSH'; + my ($vol) = $MAC ? MacPerl::Volumes() =~ /:(.*)/ : ""; + unless ($TMPDIRECTORY) { @TEMP=("${SL}usr${SL}tmp","${SL}var${SL}tmp", "C:${SL}temp","${SL}tmp","${SL}temp", "${vol}${SL}Temporary Items", @@ -3605,11 +3606,14 @@ unless ($TMPDIRECTORY) { # unshift(@TEMP,(eval {(getpwuid($>))[7]}).'/tmp') if $CGI::OS eq 'UNIX' and $> != 0; foreach (@TEMP) { - do {$TMPDIRECTORY = $_; last} if -d $_ && -w _; + do {$TMPDIRECTORY = $_; last} if -d $_ && -w _; } + } + $TMPDIRECTORY = $MAC ? "" : "." unless $TMPDIRECTORY; } -$TMPDIRECTORY = $MAC ? "" : "." unless $TMPDIRECTORY; +find_tempdir(); + $MAXTRIES = 5000; # cute feature, but overload implementation broke it @@ -3634,6 +3638,7 @@ $AUTOLOADED_ROUTINES=<<'END_OF_AUTOLOAD'; sub new { my($package,$sequence) = @_; my $filename; + find_tempdir() unless -w $TMPDIRECTORY; for (my $i = 0; $i < $MAXTRIES; $i++) { last if ! -f ($filename = sprintf("${TMPDIRECTORY}${SL}CGItemp%d",$sequence++)); } @@ -4941,7 +4946,7 @@ Generate just the protocol and net location, as in http://www.foo.com:8000 =head2 MIXING POST AND URL PARAMETERS - $color = $query->url_param('color'); + $color = $query->url_param('color'); It is possible for a script to receive CGI parameters in the URL as well as in the fill-out form by creating a form that POSTs to a URL @@ -5696,6 +5701,8 @@ a pointer to an associative array relating menu values to another associative array with the attribute's name as the key and the attribute's value as the value. +=back + =head2 CREATING A SCROLLING LIST print $query->scrolling_list('list_name', diff --git a/lib/CGI/Util.pm b/lib/CGI/Util.pm index 6c5d543..a694394 100644 --- a/lib/CGI/Util.pm +++ b/lib/CGI/Util.pm @@ -6,7 +6,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(rearrange make_attributes unescape escape expires); -$VERSION = '1.31'; +$VERSION = '1.3'; $EBCDIC = "\t" ne "\011"; if ($EBCDIC) { @@ -167,7 +167,7 @@ sub utf8_chr ($) { } elsif ($c < 0x80000000) { return sprintf("%c%c%c%c%c%c", - 0xfe | ($c >> 30), + 0xfc | ($c >> 30), 0x80 | (($c >> 24) & 0x3f), 0x80 | (($c >> 18) & 0x3f), 0x80 | (($c >> 12) & 0x3f),