6a36cc7
diff -up perl-5.10.0/lib/CGI/Apache.pm.eee perl-5.10.0/lib/CGI/Apache.pm
6a36cc7
diff -up perl-5.10.0/lib/CGI/Carp.pm.eee perl-5.10.0/lib/CGI/Carp.pm
6a36cc7
--- perl-5.10.0/lib/CGI/Carp.pm.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/Carp.pm	2008-03-27 15:23:36.000000000 +0100
6a36cc7
@@ -323,7 +323,7 @@ use File::Spec;
6a36cc7
 
6a36cc7
 $main::SIG{__WARN__}=\&CGI::Carp::warn;
6a36cc7
 
6a36cc7
-$CGI::Carp::VERSION     = '1.29';
6a36cc7
+$CGI::Carp::VERSION     = '1.30_01';
6a36cc7
 $CGI::Carp::CUSTOM_MSG  = undef;
6a36cc7
 $CGI::Carp::DIE_HANDLER = undef;
6a36cc7
 
6a36cc7
@@ -575,6 +575,7 @@ END
6a36cc7
         print STDOUT $mess;
6a36cc7
     }
6a36cc7
     else {
6a36cc7
+        print STDOUT "Status: 500\n";
6a36cc7
         print STDOUT "Content-type: text/html\n\n";
6a36cc7
         print STDOUT $mess;
6a36cc7
     }
6a36cc7
diff -up perl-5.10.0/lib/CGI/Changes.eee perl-5.10.0/lib/CGI/Changes
6a36cc7
--- perl-5.10.0/lib/CGI/Changes.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/Changes	2008-04-23 15:08:05.000000000 +0200
6a36cc7
@@ -1,3 +1,35 @@
6a36cc7
+  Version 3.37
6a36cc7
+  1. Fix pragmas so that they persist over modperl invocations (e.g. RT 34761)
6a36cc7
+  2. Fixed handling of chunked multipart uploads; thanks to Michael Bernhardt
6a36cc7
+     who reported and fixed the problem.
6a36cc7
+
6a36cc7
+  Version 3.36
6a36cc7
+  1. Fix CGI::Cookie to support cookies that are separated by "," instead of ";".
6a36cc7
+
6a36cc7
+  Version 3.35
6a36cc7
+  1. Resync with bleadperl, primarily fixing a bug in parsing semicolons in uploaded filenames.
6a36cc7
+
6a36cc7
+  Version 3.34
6a36cc7
+  1. Handle Unicode %uXXXX  escapes properly -- patch from DANKOGAI@cpan.org
6a36cc7
+  2. Fix url() method to not choke on path names that contain regex characters.
6a36cc7
+
6a36cc7
+  Version 3.33
6a36cc7
+  1. Remove uninit variable warning when calling url(-relative=>1)
6a36cc7
+  2. Fix uninit variable warnings for two lc calls
6a36cc7
+  3. Fixed failure of tempfile upload due to sprintf() taint failure in perl 5.10
6a36cc7
+
6a36cc7
+  Version 3.32
6a36cc7
+  1. Patch from Miguel Santinho to prevent sending premature headers under mod_perl 2.0
6a36cc7
+
6a36cc7
+  Version 3.31
6a36cc7
+  1. Patch from Xavier Robin so that CGI::Carp issues a 500 Status code rather than a 200 status code.
6a36cc7
+  2. Patch from Alexander Klink to select correct temporary directory in OSX Leopard so that upload works.
6a36cc7
+  3. Possibly fixed "wrapped pack" error on 5.10 and higher.
6a36cc7
+
6a36cc7
+  Version 3.30
6a36cc7
+  1. Patch from Mike Barry to handle POSTDATA in the same way as PUT.
6a36cc7
+  2. Patch from Rafael Garcia-Suarez to correctly reencode unicode values as byte values.
6a36cc7
+
6a36cc7
   Version 3.29
6a36cc7
   1. The position of file handles is now reset to zero when CGI->new is called.
6a36cc7
     (Mark Stosberg)
6a36cc7
diff -up perl-5.10.0/lib/CGI/Cookie.pm.eee perl-5.10.0/lib/CGI/Cookie.pm
6a36cc7
--- perl-5.10.0/lib/CGI/Cookie.pm.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/Cookie.pm	2008-03-28 18:15:51.000000000 +0100
6a36cc7
@@ -13,7 +13,7 @@ package CGI::Cookie;
6a36cc7
 # wish, but if you redistribute a modified version, please attach a note
6a36cc7
 # listing the modifications you have made.
6a36cc7
 
6a36cc7
-$CGI::Cookie::VERSION='1.28';
6a36cc7
+$CGI::Cookie::VERSION='1.29';
6a36cc7
 
6a36cc7
 use CGI::Util qw(rearrange unescape escape);
6a36cc7
 use CGI;
6a36cc7
@@ -51,7 +51,7 @@ sub fetch {
6a36cc7
    my %results;
6a36cc7
    my($key,$value);
6a36cc7
    
6a36cc7
-   my(@pairs) = split("[;,] ?",$raw_cookie);
6a36cc7
+   my @pairs = split("[;,] ?",$raw_cookie);
6a36cc7
    foreach (@pairs) {
6a36cc7
      s/\s*(.*?)\s*/$1/;
6a36cc7
      if (/^([^=]+)=(.*)/) {
6a36cc7
@@ -88,7 +88,7 @@ sub parse {
6a36cc7
   my ($self,$raw_cookie) = @_;
6a36cc7
   my %results;
6a36cc7
 
6a36cc7
-  my(@pairs) = split("; ?",$raw_cookie);
6a36cc7
+  my @pairs = split("[;,] ?",$raw_cookie);
6a36cc7
   foreach (@pairs) {
6a36cc7
     s/\s*(.*?)\s*/$1/;
6a36cc7
     my($key,$value) = split("=",$_,2);
6a36cc7
diff -up perl-5.10.0/lib/CGI/Fast.pm.eee perl-5.10.0/lib/CGI/Fast.pm
6a36cc7
--- perl-5.10.0/lib/CGI/Fast.pm.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/Fast.pm	2008-04-14 19:53:12.000000000 +0200
6a36cc7
@@ -55,6 +55,7 @@ sub new {
6a36cc7
      }
6a36cc7
      }
6a36cc7
      CGI->_reset_globals;
6a36cc7
+     $self->_setup_symbols(@SAVED_SYMBOLS) if @CGI::SAVED_SYMBOLS;
6a36cc7
      return $CGI::Q = $self->SUPER::new($initializer, @param);
6a36cc7
 }
6a36cc7
 
6a36cc7
diff -up perl-5.10.0/lib/CGI.pm.eee perl-5.10.0/lib/CGI.pm
6a36cc7
--- perl-5.10.0/lib/CGI.pm.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI.pm	2008-04-23 15:08:23.000000000 +0200
6a36cc7
@@ -18,8 +18,8 @@ use Carp 'croak';
6a36cc7
 # The most recent version and complete docs are available at:
6a36cc7
 #   http://stein.cshl.org/WWW/software/CGI/
6a36cc7
 
6a36cc7
-$CGI::revision = '$Id: CGI.pm,v 1.234 2007/04/16 16:58:46 lstein Exp $';
6a36cc7
-$CGI::VERSION='3.29';
6a36cc7
+$CGI::revision = '$Id: CGI.pm,v 1.251 2008/04/23 13:08:23 lstein Exp $';
6a36cc7
+$CGI::VERSION='3.37';
6a36cc7
 
6a36cc7
 # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
6a36cc7
 # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING.
6a36cc7
@@ -37,7 +37,12 @@ use constant XHTML_DTD => ['-//W3C//DTD 
6a36cc7
   $TAINTED = substr("$0$^X",0,0);
6a36cc7
 }
6a36cc7
 
6a36cc7
-$MOD_PERL = 0; # no mod_perl by default
6a36cc7
+$MOD_PERL            = 0; # no mod_perl by default
6a36cc7
+
6a36cc7
+#global settings
6a36cc7
+$POST_MAX            = -1; # no limit to uploaded files
6a36cc7
+$DISABLE_UPLOADS     = 0;
6a36cc7
+
6a36cc7
 @SAVED_SYMBOLS = ();
6a36cc7
 
6a36cc7
 
6a36cc7
@@ -91,13 +96,6 @@ sub initialize_globals {
6a36cc7
     # it can just be renamed, instead of read and written.
6a36cc7
     $CLOSE_UPLOAD_FILES = 0;
6a36cc7
 
6a36cc7
-    # Set this to a positive value to limit the size of a POSTing
6a36cc7
-    # to a certain number of bytes:
6a36cc7
-    $POST_MAX = -1;
6a36cc7
-
6a36cc7
-    # Change this to 1 to disable uploads entirely:
6a36cc7
-    $DISABLE_UPLOADS = 0;
6a36cc7
-
6a36cc7
     # Automatically determined -- don't change
6a36cc7
     $EBCDIC = 0;
6a36cc7
 
6a36cc7
@@ -111,6 +109,9 @@ sub initialize_globals {
6a36cc7
     # use CGI qw(-no_undef_params);
6a36cc7
     $NO_UNDEF_PARAMS = 0;
6a36cc7
 
6a36cc7
+    # return everything as utf-8
6a36cc7
+    $PARAM_UTF8      = 0;
6a36cc7
+
6a36cc7
     # Other globals that you shouldn't worry about.
6a36cc7
     undef $Q;
6a36cc7
     $BEEN_THERE = 0;
6a36cc7
@@ -352,6 +353,7 @@ sub new {
6a36cc7
       $self->r(Apache->request) unless $self->r;
6a36cc7
       my $r = $self->r;
6a36cc7
       $r->register_cleanup(\&CGI::_reset_globals);
6a36cc7
+      $self->_setup_symbols(@SAVED_SYMBOLS) if @SAVED_SYMBOLS;
6a36cc7
     }
6a36cc7
     else {
6a36cc7
       # XXX: once we have the new API
6a36cc7
@@ -360,6 +362,7 @@ sub new {
6a36cc7
       my $r = $self->r;
6a36cc7
       $r->subprocess_env unless exists $ENV{REQUEST_METHOD};
6a36cc7
       $r->pool->cleanup_register(\&CGI::_reset_globals);
6a36cc7
+      $self->_setup_symbols(@SAVED_SYMBOLS) if @SAVED_SYMBOLS;
6a36cc7
     }
6a36cc7
     undef $NPH;
6a36cc7
   }
6a36cc7
@@ -445,15 +448,14 @@ sub param {
6a36cc7
 
6a36cc7
     return unless defined($name) && $self->{$name};
6a36cc7
 
6a36cc7
-    my $charset = $self->charset || '';
6a36cc7
-    my $utf8    = $charset eq 'utf-8';
6a36cc7
-    if ($utf8) {
6a36cc7
-      eval "require Encode; 1;" if $utf8 && !Encode->can('decode'); # bring in these functions
6a36cc7
-      return wantarray ? map {Encode::decode(utf8=>$_) } @{$self->{$name}} 
6a36cc7
-                       : Encode::decode(utf8=>$self->{$name}->[0]);
6a36cc7
-    } else {
6a36cc7
-      return wantarray ? @{$self->{$name}} : $self->{$name}->[0];
6a36cc7
+    my @result = @{$self->{$name}};
6a36cc7
+
6a36cc7
+    if ($PARAM_UTF8) {
6a36cc7
+      eval "require Encode; 1;" unless Encode->can('decode'); # bring in these functions
6a36cc7
+      @result = map {ref $_ ? $_ : Encode::decode(utf8=>$_) } @result;
6a36cc7
     }
6a36cc7
+
6a36cc7
+    return wantarray ?  @result : $result[0];
6a36cc7
 }
6a36cc7
 
6a36cc7
 sub self_or_default {
6a36cc7
@@ -641,7 +643,7 @@ sub init {
6a36cc7
 	  last METHOD;
6a36cc7
       }
6a36cc7
 
6a36cc7
-      if ($meth eq 'POST') {
6a36cc7
+      if ($meth eq 'POST' || $meth eq 'PUT') {
6a36cc7
 	  $self->read_from_client(\$query_string,$content_length,0)
6a36cc7
 	      if $content_length > 0;
6a36cc7
 	  # Some people want to have their cake and eat it too!
6a36cc7
@@ -667,11 +669,11 @@ sub init {
6a36cc7
   }
6a36cc7
 
6a36cc7
 # YL: Begin Change for XML handler 10/19/2001
6a36cc7
-    if (!$is_xforms && $meth eq 'POST'
6a36cc7
+    if (!$is_xforms && ($meth eq 'POST' || $meth eq 'PUT')
6a36cc7
         && defined($ENV{'CONTENT_TYPE'})
6a36cc7
         && $ENV{'CONTENT_TYPE'} !~ m|^application/x-www-form-urlencoded|
6a36cc7
 	&& $ENV{'CONTENT_TYPE'} !~ m|^multipart/form-data| ) {
6a36cc7
-        my($param) = 'POSTDATA' ;
6a36cc7
+        my($param) = $meth . 'DATA' ;
6a36cc7
         $self->add_parameter($param) ;
6a36cc7
       push (@{$self->{$param}},$query_string);
6a36cc7
       undef $query_string ;
6a36cc7
@@ -904,6 +906,7 @@ sub _setup_symbols {
6a36cc7
 	$DEBUG=0,                next if /^[:-]no_?[Dd]ebug$/;
6a36cc7
 	$DEBUG=2,                next if /^[:-][Dd]ebug$/;
6a36cc7
 	$USE_PARAM_SEMICOLONS++, next if /^[:-]newstyle_urls$/;
6a36cc7
+	$PARAM_UTF8++,           next if /^[:-]utf8$/;
6a36cc7
 	$XHTML++,                next if /^[:-]xhtml$/;
6a36cc7
 	$XHTML=0,                next if /^[:-]no_?xhtml$/;
6a36cc7
 	$USE_PARAM_SEMICOLONS=0, next if /^[:-]oldstyle_urls$/;
6a36cc7
@@ -1519,7 +1522,7 @@ sub header {
6a36cc7
     push(@header,map {ucfirst $_} @other);
6a36cc7
     push(@header,"Content-Type: $type") if $type ne '';
6a36cc7
     my $header = join($CRLF,@header)."${CRLF}${CRLF}";
6a36cc7
-    if ($MOD_PERL and not $nph) {
6a36cc7
+    if (($MOD_PERL >= 1) && !$nph) {
6a36cc7
         $self->r->send_cgi_header($header);
6a36cc7
         return '';
6a36cc7
     }
6a36cc7
@@ -1699,6 +1702,7 @@ sub _style {
6a36cc7
     my $cdata_end   = $XHTML ? "\n/* ]]> */-->\n" : " -->\n";
6a36cc7
 
6a36cc7
     my @s = ref($style) eq 'ARRAY' ? @$style : $style;
6a36cc7
+    my $other = '';
6a36cc7
 
6a36cc7
     for my $s (@s) {
6a36cc7
       if (ref($s)) {
6a36cc7
@@ -1708,7 +1712,7 @@ sub _style {
6a36cc7
                        ref($s) eq 'ARRAY' ? @$s : %$s));
6a36cc7
        my $type = defined $stype ? $stype : 'text/css';
6a36cc7
        my $rel  = $alternate ? 'alternate stylesheet' : 'stylesheet';
6a36cc7
-       my $other = @other ? join ' ',@other : '';
6a36cc7
+       $other = "@other" if @other;
6a36cc7
 
6a36cc7
        if (ref($src) eq "ARRAY") # Check to see if the $src variable is an array reference
6a36cc7
        { # If it is, push a LINK tag for each one
6a36cc7
@@ -1831,7 +1835,7 @@ sub startform {
6a36cc7
     my($method,$action,$enctype,@other) = 
6a36cc7
 	rearrange([METHOD,ACTION,ENCTYPE],@p);
6a36cc7
 
6a36cc7
-    $method  = $self->escapeHTML(lc($method) || 'post');
6a36cc7
+    $method  = $self->escapeHTML(lc($method || 'post'));
6a36cc7
     $enctype = $self->escapeHTML($enctype || &URL_ENCODED);
6a36cc7
     if (defined $action) {
6a36cc7
        $action = $self->escapeHTML($action);
6a36cc7
@@ -2147,8 +2151,9 @@ END_OF_FUNC
6a36cc7
 sub checkbox {
6a36cc7
     my($self,@p) = self_or_default(@_);
6a36cc7
 
6a36cc7
-    my($name,$checked,$value,$label,$override,$tabindex,@other) = 
6a36cc7
-	rearrange([NAME,[CHECKED,SELECTED,ON],VALUE,LABEL,[OVERRIDE,FORCE],TABINDEX],@p);
6a36cc7
+    my($name,$checked,$value,$label,$labelattributes,$override,$tabindex,@other) =
6a36cc7
+       rearrange([NAME,[CHECKED,SELECTED,ON],VALUE,LABEL,LABELATTRIBUTES,
6a36cc7
+                   [OVERRIDE,FORCE],TABINDEX],@p);
6a36cc7
 
6a36cc7
     $value = defined $value ? $value : 'on';
6a36cc7
 
6a36cc7
@@ -2165,7 +2170,8 @@ sub checkbox {
6a36cc7
     my($other) = @other ? "@other " : '';
6a36cc7
     $tabindex = $self->element_tab($tabindex);
6a36cc7
     $self->register_parameter($name);
6a36cc7
-    return $XHTML ? CGI::label(qq{<input type="checkbox" name="$name" value="$value" $tabindex$checked$other/>$the_label})
6a36cc7
+    return $XHTML ? CGI::label($labelattributes,
6a36cc7
+                    qq{<input type="checkbox" name="$name" value="$value" $tabindex$checked$other/>$the_label})
6a36cc7
                   : qq{<input type="checkbox" name="$name" value="$value"$checked$other>$the_label};
6a36cc7
 }
6a36cc7
 END_OF_FUNC
6a36cc7
@@ -2192,9 +2198,11 @@ sub escapeHTML {
6a36cc7
          else {
6a36cc7
 	     $toencode =~ s{"}{"}gso;
6a36cc7
          }
6a36cc7
-         my $latin = uc $self->{'.charset'} eq 'ISO-8859-1' ||
6a36cc7
-                     uc $self->{'.charset'} eq 'WINDOWS-1252';
6a36cc7
-         if ($latin) {  # bug in some browsers
6a36cc7
+         # Handle bug in some browsers with Latin charsets
6a36cc7
+         if ($self->{'.charset'} &&
6a36cc7
+             (uc($self->{'.charset'}) eq 'ISO-8859-1' ||
6a36cc7
+              uc($self->{'.charset'}) eq 'WINDOWS-1252'))
6a36cc7
+         {
6a36cc7
                 $toencode =~ s{'}{'}gso;
6a36cc7
                 $toencode =~ s{\x8b}{‹}gso;
6a36cc7
                 $toencode =~ s{\x9b}{›}gso;
6a36cc7
@@ -2327,13 +2335,14 @@ sub _box_group {
6a36cc7
     my $self     = shift;
6a36cc7
     my $box_type = shift;
6a36cc7
 
6a36cc7
-    my($name,$values,$defaults,$linebreak,$labels,$attributes,
6a36cc7
-       $rows,$columns,$rowheaders,$colheaders,
6a36cc7
+    my($name,$values,$defaults,$linebreak,$labels,$labelattributes,
6a36cc7
+       $attributes,$rows,$columns,$rowheaders,$colheaders,
6a36cc7
        $override,$nolabels,$tabindex,$disabled,@other) =
6a36cc7
-       rearrange([      NAME,[VALUES,VALUE],[DEFAULT,DEFAULTS],LINEBREAK,LABELS,ATTRIBUTES,
6a36cc7
-		        ROWS,[COLUMNS,COLS],[ROWHEADERS,ROWHEADER],[COLHEADERS,COLHEADER],
6a36cc7
-			[OVERRIDE,FORCE],NOLABELS,TABINDEX,DISABLED
6a36cc7
-                 ],@_);
6a36cc7
+        rearrange([NAME,[VALUES,VALUE],[DEFAULT,DEFAULTS],LINEBREAK,LABELS,LABELATTRIBUTES,
6a36cc7
+                       ATTRIBUTES,ROWS,[COLUMNS,COLS],[ROWHEADERS,ROWHEADER],[COLHEADERS,COLHEADER],
6a36cc7
+                       [OVERRIDE,FORCE],NOLABELS,TABINDEX,DISABLED
6a36cc7
+                  ],@_);
6a36cc7
+
6a36cc7
 
6a36cc7
     my($result,$checked,@elements,@values);
6a36cc7
 
6a36cc7
@@ -2393,7 +2402,7 @@ sub _box_group {
6a36cc7
 
6a36cc7
         if ($XHTML) {
6a36cc7
            push @elements,
6a36cc7
-              CGI::label(
6a36cc7
+              CGI::label($labelattributes,
6a36cc7
                    qq(<input type="$box_type" name="$name" value="$_" $checkit$other$tab$attribs$disable/>$label)).${break};
6a36cc7
         } else {
6a36cc7
             push(@elements,qq/<input type="$box_type" name="$name" value="$_"$checkit$other$tab$attribs$disable>${label}${break}/);
6a36cc7
@@ -2560,6 +2569,7 @@ sub scrolling_list {
6a36cc7
     $size = $size || scalar(@values);
6a36cc7
 
6a36cc7
     my(%selected) = $self->previous_or_default($name,$defaults,$override);
6a36cc7
+
6a36cc7
     my($is_multiple) = $multiple ? qq/ multiple="multiple"/ : '';
6a36cc7
     my($has_size) = $size ? qq/ size="$size"/: '';
6a36cc7
     my($other) = @other ? " @other" : '';
6a36cc7
@@ -2692,7 +2702,7 @@ sub url {
6a36cc7
     my $request_uri =  unescape($self->request_uri) || '';
6a36cc7
     my $query_str   =  $self->query_string;
6a36cc7
 
6a36cc7
-    my $rewrite_in_use = $request_uri && $request_uri !~ /^$script_name/;
6a36cc7
+    my $rewrite_in_use = $request_uri && $request_uri !~ /^\Q$script_name/;
6a36cc7
     undef $path if $rewrite_in_use && $rewrite;  # path not valid when rewriting active
6a36cc7
 
6a36cc7
     my $uri         =  $rewrite && $request_uri ? $request_uri : $script_name;
6a36cc7
@@ -2723,6 +2733,7 @@ sub url {
6a36cc7
 
6a36cc7
     $url .= $path         if $path_info and defined $path;
6a36cc7
     $url .= "?$query_str" if $query     and $query_str ne '';
6a36cc7
+    $url ||= '';
6a36cc7
     $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg;
6a36cc7
     return $url;
6a36cc7
 }
6a36cc7
@@ -3284,10 +3295,10 @@ sub previous_or_default {
6a36cc7
 
6a36cc7
     if (!$override && ($self->{'.fieldnames'}->{$name} || 
6a36cc7
 		       defined($self->param($name)) ) ) {
6a36cc7
-	grep($selected{$_}++,$self->param($name));
6a36cc7
+	$selected{$_}++ for $self->param($name);
6a36cc7
     } elsif (defined($defaults) && ref($defaults) && 
6a36cc7
 	     (ref($defaults) eq 'ARRAY')) {
6a36cc7
-	grep($selected{$_}++,@{$defaults});
6a36cc7
+	$selected{$_}++ for @{$defaults};
6a36cc7
     } else {
6a36cc7
 	$selected{$defaults}++ if defined($defaults);
6a36cc7
     }
6a36cc7
@@ -3371,8 +3382,12 @@ sub read_multipart {
6a36cc7
 	my($param)= $header{'Content-Disposition'}=~/ name="([^"]*)"/;
6a36cc7
         $param .= $TAINTED;
6a36cc7
 
6a36cc7
-	# Bug:  Netscape doesn't escape quotation marks in file names!!!
6a36cc7
-	my($filename) = $header{'Content-Disposition'}=~/ filename="([^"]*)"/;
6a36cc7
+        # See RFC 1867, 2183, 2045
6a36cc7
+        # NB: File content will be loaded into memory should
6a36cc7
+        # content-disposition parsing fail.
6a36cc7
+        my ($filename) = $header{'Content-Disposition'}
6a36cc7
+	               =~/ filename=(("[^"]*")|([a-z\d!\#'\*\+,\.^_\`\{\}\|\~]*))/i;
6a36cc7
+        $filename =~ s/^"([^"]*)"$/$1/;
6a36cc7
 	# Test for Opera's multiple upload feature
6a36cc7
 	my($multipart) = ( defined( $header{'Content-Type'} ) &&
6a36cc7
 		$header{'Content-Type'} =~ /multipart\/mixed/ ) ?
6a36cc7
@@ -3431,7 +3446,7 @@ sub read_multipart {
6a36cc7
 
6a36cc7
 	  my ($data);
6a36cc7
 	  local($\) = '';
6a36cc7
-          my $totalbytes;
6a36cc7
+          my $totalbytes = 0;
6a36cc7
           while (defined($data = $buffer->read)) {
6a36cc7
               if (defined $self->{'.upload_hook'})
6a36cc7
                {
6a36cc7
@@ -3696,7 +3711,7 @@ sub new {
6a36cc7
     (my $safename = $name) =~ s/([':%])/ sprintf '%%%02X', ord $1 /eg;
6a36cc7
     my $fv = ++$FH . $safename;
6a36cc7
     my $ref = \*{"Fh::$fv"};
6a36cc7
-    $file =~ m!^([a-zA-Z0-9_ \'\":/.\$\\-]+)$! || return;
6a36cc7
+    $file =~ m!^([a-zA-Z0-9_\+ \'\":/.\$\\-]+)$! || return;
6a36cc7
     my $safe = $1;
6a36cc7
     sysopen($ref,$safe,Fcntl::O_RDWR()|Fcntl::O_CREAT()|Fcntl::O_EXCL(),0600) || return;
6a36cc7
     unlink($safe) if $delete;
6a36cc7
@@ -3768,7 +3783,7 @@ sub new {
6a36cc7
     }
6a36cc7
 
6a36cc7
     my $self = {LENGTH=>$length,
6a36cc7
-		CHUNKED=>!defined $length,
6a36cc7
+		CHUNKED=>!$length,
6a36cc7
 		BOUNDARY=>$boundary,
6a36cc7
 		INTERFACE=>$interface,
6a36cc7
 		BUFFER=>'',
6a36cc7
@@ -4032,10 +4047,10 @@ sub new {
6a36cc7
     my $filename;
6a36cc7
     find_tempdir() unless -w $TMPDIRECTORY;
6a36cc7
     for (my $i = 0; $i < $MAXTRIES; $i++) {
6a36cc7
-	last if ! -f ($filename = sprintf("${TMPDIRECTORY}${SL}CGItemp%d",$sequence++));
6a36cc7
+	last if ! -f ($filename = sprintf("\%s${SL}CGItemp%d", $TMPDIRECTORY, $sequence++));
6a36cc7
     }
6a36cc7
     # check that it is a more-or-less valid filename
6a36cc7
-    return unless $filename =~ m!^([a-zA-Z0-9_ \'\":/.\$\\-]+)$!;
6a36cc7
+    return unless $filename =~ m!^([a-zA-Z0-9_\+ \'\":/.\$\\-]+)$!;
6a36cc7
     # this used to untaint, now it doesn't
6a36cc7
     # $filename = $1;
6a36cc7
     return bless \$filename;
6a36cc7
@@ -4109,6 +4124,8 @@ CGI - Simple Common Gateway Interface Cl
6a36cc7
 	     hr;
6a36cc7
    }
6a36cc7
 
6a36cc7
+   print end_html;
6a36cc7
+
6a36cc7
 =head1 ABSTRACT
6a36cc7
 
6a36cc7
 This perl library uses perl5 objects to make it easy to create Web
6a36cc7
@@ -4477,6 +4494,10 @@ it, use code like this:
6a36cc7
 
6a36cc7
    my $data = $query->param('POSTDATA');
6a36cc7
 
6a36cc7
+Likewise if PUTed data can be retrieved with code like this:
6a36cc7
+
6a36cc7
+   my $data = $query->param('PUTDATA');
6a36cc7
+
6a36cc7
 (If you don't know what the preceding means, don't worry about it.  It
6a36cc7
 only affects people trying to use CGI for XML processing and other
6a36cc7
 specialized tasks.)
6a36cc7
@@ -4812,6 +4833,16 @@ If start_html()'s -dtd parameter specifi
6a36cc7
 XHTML will automatically be disabled without needing to use this 
6a36cc7
 pragma.
6a36cc7
 
6a36cc7
+=item -utf8
6a36cc7
+
6a36cc7
+This makes CGI.pm treat all parameters as UTF-8 strings. Use this with
6a36cc7
+care, as it will interfere with the processing of binary uploads. It
6a36cc7
+is better to manually select which fields are expected to return utf-8
6a36cc7
+strings and convert them using code like this:
6a36cc7
+
6a36cc7
+ use Encode;
6a36cc7
+ my $arg = decode utf8=>param('foo');
6a36cc7
+
6a36cc7
 =item -nph
6a36cc7
 
6a36cc7
 This makes CGI.pm produce a header appropriate for an NPH (no
6a36cc7
@@ -5388,7 +5419,7 @@ Generate just the protocol and net locat
6a36cc7
 If Apache's mod_rewrite is turned on, then the script name and path
6a36cc7
 info probably won't match the request that the user sent. Set
6a36cc7
 -rewrite=>1 (default) to return URLs that match what the user sent
6a36cc7
-(the original request URI). Set -rewrite->0 to return URLs that match
6a36cc7
+(the original request URI). Set -rewrite=>0 to return URLs that match
6a36cc7
 the URL after mod_rewrite's rules have run. Because the additional
6a36cc7
 path information only makes sense in the context of the rewritten URL,
6a36cc7
 -rewrite is set to false when you request path info in the URL.
6a36cc7
@@ -6389,6 +6420,9 @@ are the tab indexes of each button.  Exa
6a36cc7
   -tabindex => ['moe','minie','eenie','meenie']  # tab in this order
6a36cc7
   -tabindex => {meenie=>100,moe=>101,minie=>102,eenie=>200} # tab in this order
6a36cc7
 
6a36cc7
+The optional B<-labelattributes> argument will contain attributes
6a36cc7
+attached to the <label> element that surrounds each button.
6a36cc7
+
6a36cc7
 When the form is processed, all checked boxes will be returned as
6a36cc7
 a list under the parameter name 'group_name'.  The values of the
6a36cc7
 "on" checkboxes can be retrieved with:
6a36cc7
@@ -6546,6 +6580,9 @@ an associative array relating menu value
6a36cc7
 with the attribute's name as the key and the attribute's value as the
6a36cc7
 value.
6a36cc7
 
6a36cc7
+The optional B<-labelattributes> argument will contain attributes
6a36cc7
+attached to the <label> element that surrounds each button.
6a36cc7
+
6a36cc7
 When the form is processed, the selected radio button can
6a36cc7
 be retrieved using:
6a36cc7
 
6a36cc7
@@ -7658,10 +7695,8 @@ of CGI.pm without rewriting your old scr
6a36cc7
 
6a36cc7
 =head1 AUTHOR INFORMATION
6a36cc7
 
6a36cc7
-Copyright 1995-1998, Lincoln D. Stein.  All rights reserved.  
6a36cc7
-
6a36cc7
-This library is free software; you can redistribute it and/or modify
6a36cc7
-it under the same terms as Perl itself.
6a36cc7
+The GD.pm interface is copyright 1995-2007, Lincoln D. Stein.  It is
6a36cc7
+distributed under GPL and the Artistic License 2.0.
6a36cc7
 
6a36cc7
 Address bug reports and comments to: lstein@cshl.org.  When sending
6a36cc7
 bug reports, please provide the version of CGI.pm, the version of
6a36cc7
diff -up perl-5.10.0/lib/CGI/Pretty.pm.eee perl-5.10.0/lib/CGI/Pretty.pm
6a36cc7
diff -up perl-5.10.0/lib/CGI/Push.pm.eee perl-5.10.0/lib/CGI/Push.pm
6a36cc7
diff -up perl-5.10.0/lib/CGI/Switch.pm.eee perl-5.10.0/lib/CGI/Switch.pm
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/apache.t.eee perl-5.10.0/lib/CGI/t/apache.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/can.t.eee perl-5.10.0/lib/CGI/t/can.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/carp.t.eee perl-5.10.0/lib/CGI/t/carp.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/cookie.t.eee perl-5.10.0/lib/CGI/t/cookie.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/fast.t.eee perl-5.10.0/lib/CGI/t/fast.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/form.t.eee perl-5.10.0/lib/CGI/t/form.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/function.t.eee perl-5.10.0/lib/CGI/t/function.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/html.t.eee perl-5.10.0/lib/CGI/t/html.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/no_tabindex.t.eee perl-5.10.0/lib/CGI/t/no_tabindex.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/pretty.t.eee perl-5.10.0/lib/CGI/t/pretty.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/push.t.eee perl-5.10.0/lib/CGI/t/push.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/request.t.eee perl-5.10.0/lib/CGI/t/request.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/start_end_asterisk.t.eee perl-5.10.0/lib/CGI/t/start_end_asterisk.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/start_end_end.t.eee perl-5.10.0/lib/CGI/t/start_end_end.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/start_end_start.t.eee perl-5.10.0/lib/CGI/t/start_end_start.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/switch.t.eee perl-5.10.0/lib/CGI/t/switch.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/util-58.t.eee perl-5.10.0/lib/CGI/t/util-58.t
6a36cc7
--- perl-5.10.0/lib/CGI/t/util-58.t.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/t/util-58.t	2003-04-14 20:32:22.000000000 +0200
6a36cc7
@@ -11,11 +11,6 @@ BEGIN {
6a36cc7
 use Test::More tests => 2;
6a36cc7
 use_ok("CGI::Util");
6a36cc7
 my $uri = "\x{5c0f}\x{98fc} \x{5f3e}.txt"; # KOGAI, Dan, in Kanji
6a36cc7
-if (ord('A') == 193) { # EBCDIC.
6a36cc7
-    is(CGI::Util::escape($uri), "%FC%C3%A0%EE%F9%E5%E7%F8%20%FC%C3%C7%CA.txt",
6a36cc7
-       "# Escape string with UTF-8 (UTF-EBCDIC) flag");
6a36cc7
-} else {
6a36cc7
-    is(CGI::Util::escape($uri), "%E5%B0%8F%E9%A3%BC%20%E5%BC%BE.txt",
6a36cc7
-       "# Escape string with UTF-8 flag");
6a36cc7
-}
6a36cc7
+is(CGI::Util::escape($uri), "%E5%B0%8F%E9%A3%BC%20%E5%BC%BE.txt",
6a36cc7
+   "# Escape string with UTF-8 flag");
6a36cc7
 __END__
6a36cc7
diff -up perl-5.10.0/lib/CGI/t/util.t.eee perl-5.10.0/lib/CGI/t/util.t
6a36cc7
diff -up perl-5.10.0/lib/CGI/Util.pm.eee perl-5.10.0/lib/CGI/Util.pm
6a36cc7
--- perl-5.10.0/lib/CGI/Util.pm.eee	2007-12-18 11:47:07.000000000 +0100
6a36cc7
+++ perl-5.10.0/lib/CGI/Util.pm	2008-03-14 15:25:54.000000000 +0100
6a36cc7
@@ -141,8 +141,12 @@ sub simple_escape {
6a36cc7
 
6a36cc7
 sub utf8_chr {
6a36cc7
         my $c = shift(@_);
6a36cc7
-	return chr($c) if $] >= 5.006;
6a36cc7
-
6a36cc7
+	if ($] >= 5.006){
6a36cc7
+	    require utf8;
6a36cc7
+	    my $u = chr($c);
6a36cc7
+	    utf8::encode($u); # drop utf8 flag
6a36cc7
+	    return $u;
6a36cc7
+	}
6a36cc7
         if ($c < 0x80) {
6a36cc7
                 return sprintf("%c", $c);
6a36cc7
         } elsif ($c < 0x800) {
6a36cc7
@@ -189,6 +193,17 @@ sub unescape {
6a36cc7
     if ($EBCDIC) {
6a36cc7
       $todecode =~ s/%([0-9a-fA-F]{2})/chr $A2E[hex($1)]/ge;
6a36cc7
     } else {
6a36cc7
+	# handle surrogate pairs first -- dankogai
6a36cc7
+	$todecode =~ s{
6a36cc7
+			%u([Dd][89a-bA-B][0-9a-fA-F]{2}) # hi
6a36cc7
+		        %u([Dd][c-fC-F][0-9a-fA-F]{2})   # lo
6a36cc7
+		      }{
6a36cc7
+			  utf8_chr(
6a36cc7
+				   0x10000 
6a36cc7
+				   + (hex($1) - 0xD800) * 0x400 
6a36cc7
+				   + (hex($2) - 0xDC00)
6a36cc7
+				  )
6a36cc7
+		      }gex;
6a36cc7
       $todecode =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
6a36cc7
 	defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
6a36cc7
     }
6a36cc7
@@ -200,8 +215,12 @@ sub escape {
6a36cc7
   shift() if @_ > 1 and ( ref($_[0]) || (defined $_[1] && $_[0] eq $CGI::DefaultClass));
6a36cc7
   my $toencode = shift;
6a36cc7
   return undef unless defined($toencode);
6a36cc7
+  $toencode = eval { pack("C*", unpack("U0C*", $toencode))} || pack("C*", unpack("C*", $toencode));
6a36cc7
+
6a36cc7
   # force bytes while preserving backward compatibility -- dankogai
6a36cc7
-  $toencode = pack("C*", unpack("U0C*", $toencode));
6a36cc7
+  # but commented out because it was breaking CGI::Compress -- lstein
6a36cc7
+  # $toencode = eval { pack("U*", unpack("U0C*", $toencode))} || pack("C*", unpack("C*", $toencode));
6a36cc7
+
6a36cc7
     if ($EBCDIC) {
6a36cc7
       $toencode=~s/([^a-zA-Z0-9_.~-])/uc sprintf("%%%02x",$E2A[ord($1)])/eg;
6a36cc7
     } else {