diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-12-30 15:35:54 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-12-30 15:35:54 +0000 |
commit | 7f92e913a723c2bba1f19d536a5e9d2d6cbc9d2a (patch) | |
tree | 5059ab3deef4476d7380a549282ccb94f5afb91a /cpan/CGI | |
parent | e4d347428bac4523e0d6e7e3360f996596bc8e3d (diff) | |
download | perl-7f92e913a723c2bba1f19d536a5e9d2d6cbc9d2a.tar.gz |
Update CGI to CPAN version 3.59
[DELTA]
Version 3.59 Dec 29th, 2011
[BUG FIXES]
- We no longer read from STDIN when the Content-Length is not set, preventing
requests with no Content-Length from freezing in some cases. This is consistent
with the CGI RFC 3875, and is also consistent with CGI::Simple. However, the old
behavior may have been expected by some command-line uses of CGI.pm.
Thanks to Philip Potter and Yanick Champoux. See RT#52469 for details:
https://rt.cpan.org/Public/Bug/Display.html?id=52469
[INTERNALS]
- remove tmpdirs more aggressively. Thanks to rjbs (RT#73288)
- use Text::ParseWords instead of ancient shellwords.pl. Thanks to AlexBio.
- remove use of define(@arr). Thanks to rjbs.
- spelling fixes. Thanks to Gregor Herrmann and Alessandro Ghedini.
- fix test count and warning in t/fast.t. Thanks to Yanick.
Diffstat (limited to 'cpan/CGI')
-rw-r--r-- | cpan/CGI/Changes | 23 | ||||
-rw-r--r-- | cpan/CGI/lib/CGI.pm | 59 | ||||
-rw-r--r-- | cpan/CGI/t/rt-52469.t | 14 | ||||
-rw-r--r-- | cpan/CGI/t/tmpdir.t | 2 |
4 files changed, 40 insertions, 58 deletions
diff --git a/cpan/CGI/Changes b/cpan/CGI/Changes index 1c1b9c9435..07bd6fd070 100644 --- a/cpan/CGI/Changes +++ b/cpan/CGI/Changes @@ -1,3 +1,20 @@ +Version 3.59 Dec 29th, 2011 + + [BUG FIXES] + - We no longer read from STDIN when the Content-Length is not set, preventing + requests with no Content-Length from freezing in some cases. This is consistent + with the CGI RFC 3875, and is also consistent with CGI::Simple. However, the old + behavior may have been expected by some command-line uses of CGI.pm. + Thanks to Philip Potter and Yanick Champoux. See RT#52469 for details: + https://rt.cpan.org/Public/Bug/Display.html?id=52469 + + [INTERNALS] + - remove tmpdirs more aggressively. Thanks to rjbs (RT#73288) + - use Text::ParseWords instead of ancient shellwords.pl. Thanks to AlexBio. + - remove use of define(@arr). Thanks to rjbs. + - spelling fixes. Thanks to Gregor Herrmann and Alessandro Ghedini. + - fix test count and warning in t/fast.t. Thanks to Yanick. + Version 3.58 Nov 11th, 2011 [DOCUMENTATION] @@ -1259,7 +1276,7 @@ Version 3.00, Aug 18, 2003 21. Fixed warning in initialize_globals() under mod_perl. 22. File uploads from Macintosh versions of MSIE should now work. 23. Pragmas now preceded by dashes (-nph) rather than colons (:nph). - Old style is supported for backward compatability. + Old style is supported for backward compatibility. 24. Can now pass arguments to all functions using {} brackets, resolving historical inconsistencies. 25. Removed autoloader warnings about absent MultipartBuffer::DESTROY. @@ -1491,7 +1508,7 @@ Version 3.00, Aug 18, 2003 1. Added cookie() support routines. 2. Added -expires parameter to header(). - 3. Added cgi-lib.pl compatability mode. + 3. Added cgi-lib.pl compatibility mode. 4. Made the module more configurable for different operating systems. 5. Fixed a dumb bug in JavaScript button() method. @@ -1621,7 +1638,7 @@ Version 3.00, Aug 18, 2003 1. The user_agent() method is now documented; 2. A potential security hole in import() is now plugged. - 3. Changed name of import() to import_names() for compatability with + 3. Changed name of import() to import_names() for compatibility with CGI:: modules. Bug fixes in version 1.53 diff --git a/cpan/CGI/lib/CGI.pm b/cpan/CGI/lib/CGI.pm index 65fdb59c66..6084f0f89e 100644 --- a/cpan/CGI/lib/CGI.pm +++ b/cpan/CGI/lib/CGI.pm @@ -20,7 +20,7 @@ use Carp 'croak'; # The revision is no longer being updated since moving to git. $CGI::revision = '$Id: CGI.pm,v 1.266 2009/07/30 16:32:34 lstein Exp $'; -$CGI::VERSION='3.58'; +$CGI::VERSION='3.59'; # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. @@ -525,7 +525,7 @@ sub init { # if we get called more than once, we want to initialize # ourselves from the original query (which may be gone # if it was read from STDIN originally.) - if (defined(@QUERY_PARAM) && !defined($initializer)) { + if (@QUERY_PARAM && !defined($initializer)) { for my $name (@QUERY_PARAM) { my $val = $QUERY_PARAM{$name}; # always an arrayref; $self->param('-name'=>$name,'-value'=> $val); @@ -664,14 +664,6 @@ sub init { if ( $content_length > 0 ) { $self->read_from_client(\$query_string,$content_length,0); } - elsif (not defined $ENV{CONTENT_LENGTH}) { - $self->read_from_stdin(\$query_string); - # should this be PUTDATA in case of PUT ? - my($param) = $meth . 'DATA' ; - $self->add_parameter($param) ; - push (@{$self->{param}{$param}},$query_string); - undef $query_string ; - } # Some people want to have their cake and eat it too! # Uncomment this line to have the contents of the query string # APPENDED to the POST data. @@ -1024,47 +1016,6 @@ sub read_from_client { } END_OF_FUNC -'read_from_stdin' => <<'END_OF_FUNC', -# Read data from stdin until all is read -sub read_from_stdin { - my($self, $buff) = @_; - local $^W=0; # prevent a warning - - # - # TODO: loop over STDIN until all is read - # - - my($eoffound) = 0; - my($localbuf) = ''; - my($tempbuf) = ''; - my($bufsiz) = 1024; - my($res); - while ($eoffound == 0) { - if ( $MOD_PERL ) { - $res = $self->r->read($tempbuf, $bufsiz, 0) - } - else { - $res = read(\*STDIN, $tempbuf, $bufsiz); - } - - if ( !defined($res) ) { - # TODO: how to do error reporting ? - $eoffound = 1; - last; - } - if ( $res == 0 ) { - $eoffound = 1; - last; - } - $localbuf .= $tempbuf; - } - - $$buff = $localbuf; - - return $res; -} -END_OF_FUNC - 'delete' => <<'END_OF_FUNC', #### Method: delete # Deletes the named parameter entirely. @@ -3530,11 +3481,11 @@ sub read_from_cmdline { if ($DEBUG && @ARGV) { @words = @ARGV; } elsif ($DEBUG > 1) { - require "shellwords.pl"; + require Text::ParseWords; print STDERR "(offline mode: enter name=value pairs on standard input; press ^D or ^Z when done)\n"; chomp(@lines = <STDIN>); # remove newlines $input = join(" ",@lines); - @words = &shellwords($input); + @words = &Text::ParseWords::old_shellwords($input); } for (@words) { s/\\=/%3D/g; @@ -7950,7 +7901,7 @@ C<:cgi-lib> and C<:standard> method: =head2 Cgi-lib functions that are available in CGI.pm -In compatability mode, the following cgi-lib.pl functions are +In compatibility mode, the following cgi-lib.pl functions are available for your use: ReadParse() diff --git a/cpan/CGI/t/rt-52469.t b/cpan/CGI/t/rt-52469.t new file mode 100644 index 0000000000..4c713ed1de --- /dev/null +++ b/cpan/CGI/t/rt-52469.t @@ -0,0 +1,14 @@ +use strict; +use warnings; + +use Test::More tests => 1; # last test to print + +use CGI; + +$ENV{REQUEST_METHOD} = 'PUT'; + +my $cgi = CGI->new; + +pass 'new() returned'; + + diff --git a/cpan/CGI/t/tmpdir.t b/cpan/CGI/t/tmpdir.t index 6e3fcbd87d..1407356a2f 100644 --- a/cpan/CGI/t/tmpdir.t +++ b/cpan/CGI/t/tmpdir.t @@ -37,4 +37,4 @@ isnt($CGITempFile::TMPDIRECTORY, $testdir, "unwritable \$ENV{TMPDIR} not overridden with an unwritable \$CGITempFile::TMPDIRECTORY"); } -END { rmdir for ($testdir, $testdir2) } +END { for ($testdir, $testdir2) { chmod 0700, $_; rmdir; } } |