r75503 - in /branches/upstream/libcgi-pm-perl/current: Changes META.yml lib/CGI.pm t/url.t

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Sun Jun 12 13:16:33 UTC 2011


Author: ghedo-guest
Date: Sun Jun 12 13:16:26 2011
New Revision: 75503

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75503
Log:
[svn-upgrade] new version libcgi-pm-perl (3.55)

Modified:
    branches/upstream/libcgi-pm-perl/current/Changes
    branches/upstream/libcgi-pm-perl/current/META.yml
    branches/upstream/libcgi-pm-perl/current/lib/CGI.pm
    branches/upstream/libcgi-pm-perl/current/t/url.t

Modified: branches/upstream/libcgi-pm-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-pm-perl/current/Changes?rev=75503&op=diff
==============================================================================
--- branches/upstream/libcgi-pm-perl/current/Changes (original)
+++ branches/upstream/libcgi-pm-perl/current/Changes Sun Jun 12 13:16:26 2011
@@ -1,3 +1,29 @@
+
+Version 3.55 June 3rd, 2011
+
+    [THINGS THAT MAY BREAK YOUR CODE]
+    url() was fixed to return "PATH_INFO" when it is explicitly requested 
+    with either the path=>1 or path_info=>1 flag. 
+
+    If your code is running under mod_rewrite (or compatible) and you are calling self_url() or
+    you are calling url() and passing path_info=>1, These methods will actually be
+    returning PATH_INFO now, as you have explicitly requested, or has self_url()
+    has requested on your behalf.
+
+    The PATH_INFO has been omitted in such URLs since the issue was introduced
+    in the 3.12 release in December, 2005. 
+
+    This bug is so old your application may have come to depend on it or
+    workaround it. Check for application before upgrading to this release. 
+
+    Examples of affected method calls:
+
+     $q->url(-absolute => 1, -query => 1, -path_info => 1 ) 
+     $q->url(-path=>1)
+     $q->url(-full=>1,-path=>1) 
+     $q->url(-rewrite=>1,-path=>1)
+     $q->self_url();
+
 Version 3.54, Apr 28, 2011
    No code changes
 

Modified: branches/upstream/libcgi-pm-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-pm-perl/current/META.yml?rev=75503&op=diff
==============================================================================
--- branches/upstream/libcgi-pm-perl/current/META.yml (original)
+++ branches/upstream/libcgi-pm-perl/current/META.yml Sun Jun 12 13:16:26 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               CGI.pm
-version:            3.54
+version:            3.55
 abstract:           ~
 author:  []
 license:            unknown
@@ -19,7 +19,7 @@
         - t
         - inc
         - t
-generated_by:       ExtUtils::MakeMaker version 6.55_02
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: branches/upstream/libcgi-pm-perl/current/lib/CGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-pm-perl/current/lib/CGI.pm?rev=75503&op=diff
==============================================================================
--- branches/upstream/libcgi-pm-perl/current/lib/CGI.pm (original)
+++ branches/upstream/libcgi-pm-perl/current/lib/CGI.pm Sun Jun 12 13:16:26 2011
@@ -20,7 +20,7 @@
 
 # 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.54';
+$CGI::VERSION='3.55';
 
 # HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
 # UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING.
@@ -2856,7 +2856,6 @@
     my $query_str   =  $self->query_string;
 
     my $rewrite_in_use = $request_uri && $request_uri !~ /^\Q$script_name/;
-    undef $path if $rewrite_in_use && $rewrite;  # path not valid when rewriting active
 
     my $uri         =  $rewrite && $request_uri ? $request_uri : $script_name;
     $uri            =~ s/\?.*$//s;                                # remove query string
@@ -5653,9 +5652,7 @@
 info probably won't match the request that the user sent. Set
 -rewrite=>1 (default) to return URLs that match what the user sent
 (the original request URI). Set -rewrite=>0 to return URLs that match
-the URL after mod_rewrite's rules have run. Because the additional
-path information only makes sense in the context of the rewritten URL,
--rewrite is set to false when you request path info in the URL.
+the URL after mod_rewrite's rules have run. 
 
 =back
 

Modified: branches/upstream/libcgi-pm-perl/current/t/url.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-pm-perl/current/t/url.t?rev=75503&op=diff
==============================================================================
--- branches/upstream/libcgi-pm-perl/current/t/url.t (original)
+++ branches/upstream/libcgi-pm-perl/current/t/url.t Sun Jun 12 13:16:26 2011
@@ -1,9 +1,10 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4;    # last test to print
+use Test::More;
 
-use CGI qw/ :all /;
+use CGI ':all';
+
 
 $ENV{HTTP_X_FORWARDED_HOST} = 'proxy:8484';
 $ENV{SERVER_PROTOCOL}       = 'HTTP/1.0';
@@ -21,3 +22,50 @@
 
 is url() => 'http://proxy', 'url() with default port';
 
+subtest 'rewrite_interactions' => sub {
+    # Reference: RT#45019
+
+    local %ENV =  (
+      # These two are always set
+      'SCRIPT_NAME'     => '/real/cgi-bin/dispatch.cgi',
+      'SCRIPT_FILENAME' => '/home/mark/real/path/cgi-bin/dispatch.cgi',
+
+      # These two are added by mod_rewrite Ref: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
+
+      'SCRIPT_URL'      => '/real/path/info',
+      'SCRIPT_URI'      => 'http://example.com/real/path/info',
+
+      'PATH_INFO'       => '/path/info',
+      'REQUEST_URI'     => '/real/path/info',
+      'HTTP_HOST'       => 'example.com'
+    );
+
+    my $q = CGI->new;
+
+    is(
+        $q->url( -absolute => 1, -query => 1, -path_info => 1 ),
+        '/real/path/info',
+        '$q->url( -absolute => 1, -query => 1, -path_info => 1 ) should return complete path, even when mod_rewrite is detected.'
+    );
+    is( $q->url(), 'http://example.com/real', '$q->url(), with rewriting detected' );
+    is( $q->url(-full=>1), 'http://example.com/real', '$q->url(-full=>1), with rewriting detected' );
+    is( $q->url(-path=>1), 'http://example.com/real/path/info', '$q->url(-path=>1), with rewriting detected' );
+    is( $q->url(-path=>0), 'http://example.com/real', '$q->url(-path=>0), with rewriting detected' );
+    is( $q->url(-full=>1,-path=>1), 'http://example.com/real/path/info', '$q->url(-full=>1,-path=>1), with rewriting detected' );
+    is( $q->url(-rewrite=>1,-path=>0), 'http://example.com/real', '$q->url(-rewrite=>1,-path=>0), with rewriting detected' );
+    is( $q->url(-rewrite=>1), 'http://example.com/real',
+                                                '$q->url(-rewrite=>1), with rewriting detected' );
+    is( $q->url(-rewrite=>0), 'http://example.com/real/cgi-bin/dispatch.cgi',
+                                                '$q->url(-rewrite=>0), with rewriting detected' );
+    is( $q->url(-rewrite=>0,-path=>1), 'http://example.com/real/cgi-bin/dispatch.cgi/path/info',
+                                                '$q->url(-rewrite=>0,-path=>1), with rewriting detected' );
+    is( $q->url(-rewrite=>1,-path=>1), 'http://example.com/real/path/info',
+                                                '$q->url(-rewrite=>1,-path=>1), with rewriting detected' );
+    is( $q->url(-rewrite=>0,-path=>0), 'http://example.com/real/cgi-bin/dispatch.cgi',
+                                                '$q->url(-rewrite=>0,-path=>1), with rewriting detected' );
+};
+
+
+done_testing();
+
+




More information about the Pkg-perl-cvs-commits mailing list