diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-05-18 20:52:36 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2011-06-09 12:17:10 +0100 |
commit | be0397089ddbb1fa5b54c3d442d9c23255e1bd87 (patch) | |
tree | ee3410634877c661159fbc3742b5f73fbea7002b /cpan | |
parent | c23ee15d0c5621f673a78a873392c506a2b470f8 (diff) | |
download | perl-be0397089ddbb1fa5b54c3d442d9c23255e1bd87.tar.gz |
Updated CGI to CPAN version 3.54
[DELTA]
Version 3.54, Apr 28, 2011
No code changes
[INTERNALS]
- Address test failures in t/tmpdir.t, thanks to Niko Tyni.
Some tests here are failing on some platforms and have been marked as TODO.
Version 3.53, Apr 25, 2011
[NEW FEATURES]
- The DELETE HTTP verb is now supported.
(RT#52614, James Robson, Eduardo Ari�o de la Rubia)
[INTERNALS]
- Correct t/tmpdir.t MANIFEST entry. (RT#64949)
- Update minimum required Perl version to be Perl 5.8.1, which
has been out since 2003. This allows us to drop some hacks
and exceptions (Mark Stosberg)
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/CGI/Changes | 181 | ||||
-rw-r--r-- | cpan/CGI/lib/CGI.pm | 10 | ||||
-rw-r--r-- | cpan/CGI/lib/CGI/Util.pm | 88 | ||||
-rw-r--r-- | cpan/CGI/t/delete.t | 57 | ||||
-rw-r--r-- | cpan/CGI/t/tmpdir.t | 40 |
5 files changed, 234 insertions, 142 deletions
diff --git a/cpan/CGI/Changes b/cpan/CGI/Changes index 565905ef89..95c43e5eac 100644 --- a/cpan/CGI/Changes +++ b/cpan/CGI/Changes @@ -1,15 +1,34 @@ -Version 3.52 +Version 3.54, Apr 28, 2011 + No code changes + [INTERNALS] + - Address test failures in t/tmpdir.t, thanks to Niko Tyni. + Some tests here are failing on some platforms and have been marked as TODO. + +Version 3.53, Apr 25, 2011 + + [NEW FEATURES] + - The DELETE HTTP verb is now supported. + (RT#52614, James Robson, Eduardo Ari�o de la Rubia) + + [INTERNALS] + - Correct t/tmpdir.t MANIFEST entry. (RT#64949) + - Update minimum required Perl version to be Perl 5.8.1, which + has been out since 2003. This allows us to drop some hacks + and exceptions (Mark Stosberg) + +Version 3.52, Jan 24, 2011 + [DOCUMENTATION] - The documentation for multi-line header handling was been updated to reflect - the changes in 3.51. (Mark Stosberg, ntyni@iki.fi) + the changes in 3.51. (Mark Stosberg, ntyni@iki.fi) [INTERNALS] - - Add missing t/tmpfile.t file. (RT#64949) - - Fix warning in t/cookie.t (RT#64570, Chris Williams, Rainer Tammer, Mark Stosberg) + - Add missing t/tmpfile.t file. (RT#64949) + - Fix warning in t/cookie.t (RT#64570, Chris Williams, Rainer Tammer, Mark Stosberg) - Fixed logic bug in t/multipart_init.t (RT#64261, Niko Tyni) -Version 3.51 +Version 3.51, Jan 5, 2011 [NEW FEATURES] - A new option to set $CGI::Carp::TO_BROWSER = 0, allows you to explicitly @@ -65,7 +84,7 @@ Version 3.51 - Re-fixing https test in http.t. (RT#54768, thanks to SPROUT) - param_fetch no longer triggers a warning when called with no arguments (ysth, Mark Stosberg) -Version 3.50 +Version 3.50, Nov 8, 2010 [SECURITY] 1. The MIME boundary in multipart_init is now random. @@ -73,17 +92,17 @@ Version 3.50 2. Further improvements to handling of newlines embedded in header values. An exception is thrown if header values contain invalid newlines. Thanks to Michal Zalewski, Max Kanat-Alexander, Yanick Champoux, - Lincoln Stein, Frédéric Buclin and Mark Stosberg + Lincoln Stein, Fr�d�ric Buclin and Mark Stosberg [DOCUMENTATION] 1. Correcting/clarifying documentation for param_fetch(). Thanks to - Renée Bäcker. (RT#59132) + Ren�e B�cker. (RT#59132) [INTERNALS] 1. Fixing https test in http.t. (RT#54768) 2. Tests were added for multipart_init(). Thanks to Mark Stosberg and CGI::Simple. -Version 3.49 +Version 3.49, Feb 5th, 2010 [BUG FIXES] 1. Fix a regression since 3.44 involving a case when the header includes "Content-Length: 0". @@ -104,7 +123,7 @@ Version 3.49 1. More tests were added for autoescape, thanks to Bob Kuo. (RT#25485) 2. Attempt to avoid test failures with t/fast, thanks to Steve Hay. (RT#49599) -Version 3.48 +Version 3.48, Sep 25, 2009 [BUG FIXES] 1. <optgroup> default values are now properly escaped. @@ -121,14 +140,15 @@ Version 3.48 [INTERNALS] 1. More tests were added for autoescape, thanks to Bob Kuo. (RT#25485) -Version 3.47 - Released September 9th, 2009. +Version 3.47, Sep 9, 2009 + No code changes. [INTERNALS] Re-release of 3.46, which did not contain a proper MANIFEST Version 3.46 + [BUG FIXES] 1. In CGI::Pretty, we no longer add line breaks after tags we claim not to format. Thanks to rrt, Bob Kuo and and Mark Stosberg. (RT#42114). @@ -152,7 +172,7 @@ Version 3.46 11.Calling CGI->new() no longer clobbers the value of $_ in the current scope. Thanks to Alexey Tourbin, Bob Kuo and Mark Stosberg. (RT#25131) 12.UTF-8 params should not get double-decoded now. - Thanks to Yves, Bodo, Burak Gürsoy, and Michael Schout. (RT#19913) + Thanks to Yves, Bodo, Burak G�rsoy, and Michael Schout. (RT#19913) 13.We now give objects passed to CGI::Carp::die a chance to be stringified. Thanks to teek and Yanick Champoux (RT#41530) 14.Turning off autoEscape() now only affects the behavior of built-in HTML @@ -181,7 +201,8 @@ Version 3.46 2. Automated tests for hidden() have been added, thanks to Russel Jenkins and Mark Stosberg (RT#20436) 3. t/util.t has been updated to use Test::More instead of a home-grown test function. Thanks to Bob Kuo. -Version 3.45 +Version 3.45, Aug 14, 2009 + [BUG FIXES] 1. Prevent warnings about "uninitialized values" for REQUEST_URI, HTTP_USER_AGENT and other environment variables. Patches by Callum Gibson, heiko and Mark Stosberg. (RT#24684, RT#29065) @@ -199,7 +220,7 @@ Version 3.45 8. Support for <optgroup> with scrolling_list() now works the same way as it does for popup_menu(). Thanks to Stuart Johnston (RT#30097) 9. CGI::Pretty now works properly when $" is set to ''. Thanks to Jim Keenan (RT#12401) - 10. Fix crash when used in combination with PerlEx::DBI. Thanks to Burak Gürsoy (RT#19902) + 10. Fix crash when used in combination with PerlEx::DBI. Thanks to Burak G�rsoy (RT#19902) [DOCUMENTATION] 1. Several typos were fixed, Thanks to ambs. (RT#41105) @@ -220,41 +241,48 @@ Version 3.45 4. CGI::Switch and CGI::Apache now properly set their VERSION in their own name space. Thanks to Alexey Tourbin (RT#11941,RT#11942) - Version 3.44 +Version 3.44, Jul 30, 2009 + 1. Patch from Kurt Jaeger to allow HTTP PUT even if the content length is unknown. 2. Patch from Pavel merdin to fix a problem for one of the FireFox addons. 3. Fixed issue in mod_perl & fastCGI environment of cookies returned from CGI->cookie() leaking from one session to another. - Version 3.43 +Version 3.43, Apr 06, 2009 + 1. Documentation patch from MARKSTOS@cpan.org to replace all occurrences of "new CGI" with CGI->new()" to reflect best perl practices. 2. Patch from Stepan Kasal to fix utf-8 related problems in perl 5.10 - Version 3.42 +Version 3.42, Sep 08, 2008 + 1. Added patch from Renee Baecker that makes it possible to subclass CGI::Pretty. 2. Added patch from Nicholas Clark to allow ~ characters in temporary directories. 3. Added patch from Renee Baecker that fixes the inappropriate escaping of fields in multipart headers. - Version 3.41 +Version 3.41, Aug 25, 2008 + 1. Fix url() returning incorrect path when query string contains escaped newline. 2. Added additional windows temporary directories and environment variables, courtesy patch from Renee Baecker 3. Added a handle() method to the lightweight upload filehandles. This method returns a real IO::Handle object. 4. Added patch from Tony Vanlingen to fix deep recursion warnings in CGI::Pretty. - Version 3.40 +Version 3.40, Aug 06, 2008 + 1. Fixed CGI::Fast docs to eliminate references to a "special" version of Perl. 2. Makefile.PL now depends on FCGI so that CGI::Fast installs properly. 3. Fix script_name() call from Stephane Chazelas. - Version 3.39 +Version 3.39, Jun 29, 2008 + 1. Fixed regression in "exists" function when using tied interface to CGI via $q->Vars. - Version 3.38 +Version 3.38, Jun 25, 2008 + 1. Fix annoying warning in http://rt.cpan.org/Ticket/Display.html?id=34551 2. Added nobr() function http://rt.cpan.org/Ticket/Display.html?id=35377 3. popup_menu() allows multiple items to be selected by default, satisfying @@ -265,56 +293,68 @@ Version 3.45 6. Fixed minor warning described at http://rt.cpan.org/Public/Bug/Display.html?id=36435 7. Fixed overlap of attribute and parameter space described in http://rt.perl.org/rt3//Ticket/Display.html?id=24294 - Version 3.37 +Version 3.37, Apr 22, 2008 + 1. Fix pragmas so that they persist over modperl invocations (e.g. RT 34761) 2. Fixed handling of chunked multipart uploads; thanks to Michael Bernhardt who reported and fixed the problem. - Version 3.36 +Version 3.36 + 1. Fix CGI::Cookie to support cookies that are separated by "," instead of ";". - Version 3.35 +Version 3.35, Mar 27, 2008 + 1. Resync with bleadperl, primarily fixing a bug in parsing semicolons in uploaded filenames. - Version 3.34 +Version 3.34, Mar 18, 2008 + 1. Handle Unicode %uXXXX escapes properly -- patch from DANKOGAI@cpan.org 2. Fix url() method to not choke on path names that contain regex characters. - Version 3.33 +Version 3.33, Jan 02, 2008 + 1. Remove uninit variable warning when calling url(-relative=>1) 2. Fix uninit variable warnings for two lc calls 3. Fixed failure of tempfile upload due to sprintf() taint failure in perl 5.10 - Version 3.32 +Version 3.32, Dec 27, 2007 + 1. Patch from Miguel Santinho to prevent sending premature headers under mod_perl 2.0 - Version 3.31 +Version 3.31, Nov 30, 2007 + 1. Patch from Xavier Robin so that CGI::Carp issues a 500 Status code rather than a 200 status code. 2. Patch from Alexander Klink to select correct temporary directory in OSX Leopard so that upload works. 3. Possibly fixed "wrapped pack" error on 5.10 and higher. - Version 3.30 +Version 3.30 + 1. Patch from Mike Barry to handle POSTDATA in the same way as PUT. 2. Patch from Rafael Garcia-Suarez to correctly reencode unicode values as byte values. - Version 3.29 +Version 3.29, Apr 16, 2007 + 1. The position of file handles is now reset to zero when CGI->new is called. (Mark Stosberg) 2. uploadInfo() now works across multiple object instances. Also, the first tests for uploadInfo() were added as part of the fix. (CPAN bug 11895, with contributions from drfrench and Mark Stosberg). - Version 3.28 +Version 3.28, Mar 29, 2007 + 1. Applied patch from Allen Day that makes Cookie parsing RFC2109 compliant (attribute/values can be separated by commas as well as semicolons). 2. Applied patch from Stephan Struckmann that allows script_name() to be set correctly. 3. Fixed problem with url(-full) in which port number appears twice. - Version 3.27 +Version 3.27, Feb 27, 2007 + 1. Applied patch from Steve Taylor that allows checkbox_groups to be disabled with a new -disabled=> option. - Version 3.26 +Version 3.26 + 1. Fixed alternate stylesheet behavior so that it is insensitive to order of declarations. 2. Patch from John Binns to allow users to provide a callback to CGI::Carp. 3. Added "~" as an unreserved character in escape(). @@ -322,31 +362,37 @@ Version 3.45 5. Fixed outdated documentation (and behavior) of -language in start_html -script option. 6. Fixed bug in seconds calculation in CGI::Util::expire_calc. - Version 3.25 +Version 3.25, Sep 28, 2006 + 1. Fixed the link to the Netscape frames page. 2. Added ability to specify an alternate stylesheet. 3. Add support for XForms POST submssion both as application/xml or as multipart/related - Version 3.24 +Version 3.24 + 1. In startform(), if request_uri() returns undef, then falls back to self_url(). This should rarely happen except when run outside of the CGI environment. 2. image button alignment options were mistakenly being capitalized, causing xhtml validation to fail. - Version 3.23 +Version 3.23, Aug 23, 2006 + 1. Typo in upload() persisted, now fixed for real. Thanks to Emanuele Zeppieri for correct patch and regression test. - Version 3.22 +Version 3.22, Aug 23, 2006 + 1. Typo in upload() function broke uploads. Now fixed (CPAN bug 21126). - Version 3.21 +Version 3.21, Aug 21, 2006 + 1. Don't try to read data at all when POST > $POST_MAX. 2. Fixed bug that caused $cgi->param('name',undef,'value') to unset param('name') entirely. 3. Fixed bug in which upload() sometimes returns empty. (CPAN bug #12694). 4. Incorporated patch from BURAK@cpan.org to support HTTPcookies (CPAN bug 21019). - Version 3.20 +Version 3.20 + 1. Patch from David Wheeler for CGI::Cookie->bake(). Uses mod_perl headers_out->add() rather than headers_out->set(). 2. Fixed problem identified by Andrei Voronkov in which start_form() output was screwed @@ -354,7 +400,8 @@ Version 3.45 3. Quashed uninitialized variable warnings coming from script_name(), url() and other functions that require access to the PATH_INFO environment variable. - Version 3.19 +Version 3.19 + 1. Added patch from Stephen Frost that allows one to suppress use of the temp file that is created during uploads. 2. Fixed problem noted by Martin Foster in which regular expression meta-character terms @@ -363,12 +410,14 @@ Version 3.45 3. More fixes to the url() method. 4. Removed "hack to fix broken PATH_INFO in MSII". - Version 3.18 +Version 3.18 + 1. Doc typo fixes. 2. Patch from Steve Peters to default the document type to match the charset. 3. Fixed param() so that param(-name=>'foo',-values=>[]) sets the parameter to empty list. - Version 3.17 Fri Feb 24 14:01:27 EST 2006 +Version 3.17, Feb 24, 2006 + 1. Added patch from Mike Hanafey which caused 0 arguments to CGI::Cookie->new() to be treated as empty. 2. Patch to CGI::Carp from Peter Whaite to fix the unfixable problem of CGI::Carp @@ -377,7 +426,8 @@ Version 3.45 with another's variables. 4. Fixed upload failure on files that contain semicolons in their names. - Version 3.16 Wed Feb 8 13:29:11 EST 2006 +Version 3.16, Feb 8, 2006 + 1. header() -charset option now works even when the MIME type is not "text". 2. Fixed documentation for cookie() function and fastCGI. 3. Upload filehandles now only closed automatically on Windows systems. @@ -388,16 +438,20 @@ Version 3.45 but was "Moved". 7. Fixed charset in start_html() and header() to be in synch. - Version 3.15 Wed Dec 7 15:13:22 EST 2005 +Version 3.15, Dec 7, 2005 + 1. Remove extraneous "?" from self_url() when URI contains a ? but no query string. - Version 3.14 Tue Dec 6 17:12:03 EST 2005 +Version 3.14, Dec 6, 2005 + 1. Fixed broken scrolling_list() select attribute. - Version 3.13 +Version 3.13, Dec 4, 2005 + 1. Removed extraneous empty "?" from end of self_url(). - Version 3.12 +Version 3.12, Dec 4, 2005 + 1. Fixed virtual_port so that it works properly with https protocol. 2. Fixed documentation for upload_hook(). 3. Added POSTDATA documentation. @@ -414,7 +468,8 @@ Version 3.45 9. Fixed CGI::Carp to work correctly with Mod_perl 1.29 in an Apache 2 environment. 10. Setting $CGI::TMPDIRECTORY should now be effective. - Version 3.11 +Version 3.11, Aug 3, 2005 + 1. Killed warning in CGI::Cookie about MOD_PERL_API_VERSION 2. Fixed append() so that it works in function mode. 3. Workaround for a bug that appears in Apache2 versions through 2.0.54 @@ -424,21 +479,25 @@ Version 3.45 not handle the uncommon case of a ScriptAlias directive that adds additional path information to the end of the translated URI. - Version 3.10 +Version 3.10, May 13, 2005 + 1. Added Apache2::RequestIO, which is necessary for mp2 interoperability. - Version 3.09 +Version 3.09, May 5, 2005 + 1. Fixed tabindex="0" when using CGI to create forms without a prior start_html 2. Removed warning about non-numeric MOD_PERL_API_VERSION. - Version 3.08 +Version 3.08, Apr 20, 2005 + 1. update support for mod_perl 2.0. versions prior to mod_perl 1.999_22 (2.0.0-RC5) are no longer supported. - Version 3.07 +Version 3.07, Mar 14, 2005 + 1. Fixed typo in mod_perl detection. - Version 3.06 +Version 3.06, Mar 09, 2005 1. Fixed bare call to script() in start_html 2. Moved Fh::DESTROY out of autoloaded functions so as to avoid @@ -467,7 +526,7 @@ Version 3.45 higher perls (fix courtesy Slaven Rezic). - Version 3.05 +Version 3.05, Apr 12, 2004 1. Fixed uninitialized variable warning on start_form() when running from command line. @@ -500,23 +559,23 @@ Version 3.45 15. Fixed documentation bug in -style argument to start_html() 16. Added -status argument to redirect(). - Version 3.04 +Version 3.04, Jan 18, 2004 1. Fixed the problem with mod_perl crashing when "defaults" button pressed. - Version 3.03 +Version 3.03, Jan 13, 2004 1. Fix upload hook functionality 2. Workaround for CGI->unescape_html() 3. Bumped version numbers in CGI::Fast and CGI::Util for 5.8.3-tobe - Version 3.02 +Version 3.02 1. Bring in Apache::Response just in case. 2. File upload on EBCDIC systems now works. - Version 3.01 +Version 3.01, Dec 10, 2003 1. No fix yet for upload failures when running on EBCDIC server. 2. Fixed uninitialized glob warnings that appeared when file @@ -539,7 +598,7 @@ Version 3.45 12. Added virtual_port() method for finding out what port server is listening on in a virtual-host aware fashion. - Version 3.00 +Version 3.00, Aug 18, 2003 1. Patch from Randal Schwartz to fix bug introduced by cross-site scripting vulnerability "fix." @@ -693,7 +752,7 @@ Version 3.45 Version 2.83 1. Fixed autoEscape() documentation inconsistencies. - 2. Patch from Ville Skyttä to fix a number of XHTML inconsistencies. + 2. Patch from Ville Skytt� to fix a number of XHTML inconsistencies. 3. Added Max-Age to list of CGI::Cookie headers. Version 2.82 diff --git a/cpan/CGI/lib/CGI.pm b/cpan/CGI/lib/CGI.pm index eed7e6b5ee..876ba27683 100644 --- a/cpan/CGI/lib/CGI.pm +++ b/cpan/CGI/lib/CGI.pm @@ -1,5 +1,5 @@ package CGI; -require 5.006; +require 5.008001; use Carp 'croak'; # See the bottom of this file for the POD documentation. Search for the @@ -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.52'; +$CGI::VERSION='3.54'; # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES. # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING. @@ -648,9 +648,9 @@ sub init { last METHOD; } - # If method is GET or HEAD, fetch the query from + # If method is GET, HEAD or DELETE, fetch the query from # the environment. - if ($is_xforms || $meth=~/^(GET|HEAD)$/) { + if ($is_xforms || $meth=~/^(GET|HEAD|DELETE)$/) { if ($MOD_PERL) { $query_string = $self->r->args; } else { @@ -4524,7 +4524,7 @@ HTML "standards". $query = CGI->new; -This will parse the input (from both POST and GET methods) and store +This will parse the input (from POST, GET and DELETE methods) and store it into a perl5 object called $query. Any filehandles from file uploads will have their position reset to diff --git a/cpan/CGI/lib/CGI/Util.pm b/cpan/CGI/lib/CGI/Util.pm index ef95c9f018..b059281d8e 100644 --- a/cpan/CGI/lib/CGI/Util.pm +++ b/cpan/CGI/lib/CGI/Util.pm @@ -1,18 +1,17 @@ package CGI::Util; - +require 5.008001; use strict; -use vars qw($VERSION @EXPORT_OK @ISA @A2E @E2A); require Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape +our @ISA = qw(Exporter); +our @EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape expires ebcdic2ascii ascii2ebcdic); -$VERSION = '3.51'; +our $VERSION = '3.53'; use constant EBCDIC => "\t" ne "\011"; # (ord('^') == 95) for codepage 1047 as on os390, vmesa -@A2E = ( +our @A2E = ( 0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 21, 11, 12, 13, 14, 15, 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, 64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, @@ -30,7 +29,7 @@ use constant EBCDIC => "\t" ne "\011"; 68, 69, 66, 70, 67, 71,156, 72, 84, 81, 82, 83, 88, 85, 86, 87, 140, 73,205,206,203,207,204,225,112,221,222,219,220,141,142,223 ); -@E2A = ( +our @E2A = ( 0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15, 16, 17, 18, 19,157, 10, 8,135, 24, 25,146,143, 28, 29, 30, 31, 128,129,130,131,132,133, 23, 27,136,137,138,139,140, 5, 6, 7, @@ -162,47 +161,10 @@ sub simple_escape { } sub utf8_chr { - my $c = shift(@_); - if ($] >= 5.006){ - require utf8; - my $u = chr($c); - utf8::encode($u); # drop utf8 flag - return $u; - } - if ($c < 0x80) { - return sprintf("%c", $c); - } elsif ($c < 0x800) { - return sprintf("%c%c", 0xc0 | ($c >> 6), 0x80 | ($c & 0x3f)); - } elsif ($c < 0x10000) { - return sprintf("%c%c%c", - 0xe0 | ($c >> 12), - 0x80 | (($c >> 6) & 0x3f), - 0x80 | ( $c & 0x3f)); - } elsif ($c < 0x200000) { - return sprintf("%c%c%c%c", - 0xf0 | ($c >> 18), - 0x80 | (($c >> 12) & 0x3f), - 0x80 | (($c >> 6) & 0x3f), - 0x80 | ( $c & 0x3f)); - } elsif ($c < 0x4000000) { - return sprintf("%c%c%c%c%c", - 0xf8 | ($c >> 24), - 0x80 | (($c >> 18) & 0x3f), - 0x80 | (($c >> 12) & 0x3f), - 0x80 | (($c >> 6) & 0x3f), - 0x80 | ( $c & 0x3f)); - - } elsif ($c < 0x80000000) { - return sprintf("%c%c%c%c%c%c", - 0xfc | ($c >> 30), - 0x80 | (($c >> 24) & 0x3f), - 0x80 | (($c >> 18) & 0x3f), - 0x80 | (($c >> 12) & 0x3f), - 0x80 | (($c >> 6) & 0x3f), - 0x80 | ( $c & 0x3f)); - } else { - return utf8_chr(0xfffd); - } + my $c = shift(@_); + my $u = chr($c); + utf8::encode($u); # drop utf8 flag + return $u; } # unescape URL-encoded data @@ -236,7 +198,7 @@ sub unescape { # We cannot use the %u escapes, they were rejected by W3C, so the official # way is %XX-escaped utf-8 encoding. # Naturally, Unicode strings have to be converted to their utf-8 byte -# representation. (No action is required on 5.6.) +# representation. # Byte strings were traditionally used directly as a sequence of octets. # This worked if they actually represented binary data (i.e. in CGI::Compress). # This also worked if these byte strings were actually utf-8 encoded; e.g., @@ -245,39 +207,13 @@ sub unescape { # was always so and cannot be fixed without breaking the binary data case. # -- Stepan Kasal <skasal@redhat.com> # -if ($] == 5.008) { - package utf8; - - no warnings 'redefine'; # needed for Perl 5.8.1+ - - my $is_utf8_redefinition = <<'EOR'; - sub is_utf8 { - my ($text) = @_; - - my $ctext = pack q{C0a*}, $text; - - return ($text ne $ctext) && ($ctext =~ m/^( - [\x09\x0A\x0D\x20-\x7E] - | [\xC2-\xDF][\x80-\xBF] - | \xE0[\xA0-\xBF][\x80-\xBF] - | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} - | \xED[\x80-\x9F][\x80-\xBF] - | \xF0[\x90-\xBF][\x80-\xBF]{2} - | [\xF1-\xF3][\x80-\xBF]{3} - | \xF4[\x80-\x8F][\x80-\xBF]{2} - )*$/xo); - } -EOR - - eval $is_utf8_redefinition; -} sub escape { # If we being called in an OO-context, discard the first argument. shift() if @_ > 1 and ( ref($_[0]) || (defined $_[1] && $_[0] eq $CGI::DefaultClass)); my $toencode = shift; return undef unless defined($toencode); - utf8::encode($toencode) if ($] >= 5.008 && utf8::is_utf8($toencode)); + utf8::encode($toencode) if utf8::is_utf8($toencode); if (EBCDIC) { $toencode=~s/([^a-zA-Z0-9_.~-])/uc sprintf("%%%02x",$E2A[ord($1)])/eg; } else { diff --git a/cpan/CGI/t/delete.t b/cpan/CGI/t/delete.t new file mode 100644 index 0000000000..5c0ceb1a8f --- /dev/null +++ b/cpan/CGI/t/delete.t @@ -0,0 +1,57 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; + +use Test::More; + +use CGI (); +use Config; + +my $loaded = 1; + +$| = 1; + +######################### End of black magic. + +# Set up a CGI environment +$ENV{REQUEST_METHOD} = 'DELETE'; +$ENV{QUERY_STRING} = 'game=chess&game=checkers&weather=dull'; +$ENV{PATH_INFO} = '/somewhere/else'; +$ENV{PATH_TRANSLATED} = '/usr/local/somewhere/else'; +$ENV{SCRIPT_NAME} = '/cgi-bin/foo.cgi'; +$ENV{SERVER_PROTOCOL} = 'HTTP/1.0'; +$ENV{SERVER_PORT} = 8080; +$ENV{SERVER_NAME} = 'the.good.ship.lollypop.com'; +$ENV{REQUEST_URI} = "$ENV{SCRIPT_NAME}$ENV{PATH_INFO}?$ENV{QUERY_STRING}"; +$ENV{HTTP_LOVE} = 'true'; + +my $q = new CGI; +ok $q,"CGI::new()"; +is $q->request_method => 'DELETE',"CGI::request_method()"; +is $q->query_string => 'game=chess;game=checkers;weather=dull',"CGI::query_string()"; +is $q->param(), 2,"CGI::param()"; +is join(' ',sort $q->param()), 'game weather',"CGI::param()"; +is $q->param('game'), 'chess',"CGI::param()"; +is $q->param('weather'), 'dull',"CGI::param()"; +is join(' ',$q->param('game')), 'chess checkers',"CGI::param()"; +ok $q->param(-name=>'foo',-value=>'bar'),'CGI::param() put'; +is $q->param(-name=>'foo'), 'bar','CGI::param() get'; +is $q->query_string, 'game=chess;game=checkers;weather=dull;foo=bar',"CGI::query_string() redux"; +is $q->http('love'), 'true',"CGI::http()"; +is $q->script_name, '/cgi-bin/foo.cgi',"CGI::script_name()"; +is $q->url, 'http://the.good.ship.lollypop.com:8080/cgi-bin/foo.cgi',"CGI::url()"; +is $q->self_url, + 'http://the.good.ship.lollypop.com:8080/cgi-bin/foo.cgi/somewhere/else?game=chess;game=checkers;weather=dull;foo=bar', + "CGI::url()"; +is $q->url(-absolute=>1), '/cgi-bin/foo.cgi','CGI::url(-absolute=>1)'; +is $q->url(-relative=>1), 'foo.cgi','CGI::url(-relative=>1)'; +is $q->url(-relative=>1,-path=>1), 'foo.cgi/somewhere/else','CGI::url(-relative=>1,-path=>1)'; +is $q->url(-relative=>1,-path=>1,-query=>1), + 'foo.cgi/somewhere/else?game=chess;game=checkers;weather=dull;foo=bar', + 'CGI::url(-relative=>1,-path=>1,-query=>1)'; +$q->delete('foo'); +ok !$q->param('foo'),'CGI::delete()'; + + +done_testing(); diff --git a/cpan/CGI/t/tmpdir.t b/cpan/CGI/t/tmpdir.t new file mode 100644 index 0000000000..6e3fcbd87d --- /dev/null +++ b/cpan/CGI/t/tmpdir.t @@ -0,0 +1,40 @@ +#!perl +use Test::More tests => 9; +use strict; + +my ($testdir, $testdir2); + +BEGIN { + $testdir = "CGItest"; + $testdir2 = "CGItest2"; + for ($testdir, $testdir2) { + ( -d ) || mkdir $_; + ( ! -w ) || chmod 0700, $_; + } + $CGITempFile::TMPDIRECTORY = $testdir; + $ENV{TMPDIR} = $testdir2; +} + +use CGI; +is($CGITempFile::TMPDIRECTORY, $testdir, "can pre-set \$CGITempFile::TMPDIRECTORY"); +CGITempFile->new; +is($CGITempFile::TMPDIRECTORY, $testdir, "\$CGITempFile::TMPDIRECTORY unchanged"); + +TODO: { + local $TODO = "figuring out why these tests fail on some platforms"; + ok(chmod 0500, $testdir, "revoking write access to $testdir"); + ok(! -w $testdir, "write access to $testdir revoked"); +CGITempFile->new; +is($CGITempFile::TMPDIRECTORY, $testdir2, + "unwritable \$CGITempFile::TMPDIRECTORY overridden"); + +ok(chmod 0500, $testdir2, "revoking write access to $testdir2"); +ok(! -w $testdir, "write access to $testdir revoked"); +CGITempFile->new; +isnt($CGITempFile::TMPDIRECTORY, $testdir2, + "unwritable \$ENV{TMPDIR} overridden"); +isnt($CGITempFile::TMPDIRECTORY, $testdir, + "unwritable \$ENV{TMPDIR} not overridden with an unwritable \$CGITempFile::TMPDIRECTORY"); +} + +END { rmdir for ($testdir, $testdir2) } |