r76095 - in /branches/upstream/libhttp-parser-xs-perl/current: Changes META.yml README XS.xs lib/HTTP/Parser/XS.pm lib/HTTP/Parser/XS/PP.pm t/01simple.t

fabreg-guest at users.alioth.debian.org fabreg-guest at users.alioth.debian.org
Sun Jun 19 10:32:57 UTC 2011


Author: fabreg-guest
Date: Sun Jun 19 10:32:55 2011
New Revision: 76095

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76095
Log:
[svn-upgrade] new version libhttp-parser-xs-perl (0.14)

Modified:
    branches/upstream/libhttp-parser-xs-perl/current/Changes
    branches/upstream/libhttp-parser-xs-perl/current/META.yml
    branches/upstream/libhttp-parser-xs-perl/current/README
    branches/upstream/libhttp-parser-xs-perl/current/XS.xs
    branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm
    branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS/PP.pm
    branches/upstream/libhttp-parser-xs-perl/current/t/01simple.t

Modified: branches/upstream/libhttp-parser-xs-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/Changes?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/Changes (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/Changes Sun Jun 19 10:32:55 2011
@@ -1,4 +1,7 @@
 Revision history for Perl extension HTTP::Parser::XS.
+
+0.14
+	- do not include '#' and the following characters in URI in PATH_INFO or QUERY_STRING
 
 0.13
 	- fix compile error on GCC < 3 (RT #63074)

Modified: branches/upstream/libhttp-parser-xs-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/META.yml?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/META.yml (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/META.yml Sun Jun 19 10:32:55 2011
@@ -21,4 +21,4 @@
     - t
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.13
+version: 0.14

Modified: branches/upstream/libhttp-parser-xs-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/README?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/README (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/README Sun Jun 19 10:32:55 2011
@@ -28,7 +28,7 @@
       my %special_headers = (
         'content-length' => undef,
       );
-      my($ret, $status, $message, $headers)
+      my($ret, $minor_version, $status, $message, $headers)
         = parse_http_response($response, HEADERS_AS_ARRAYREF, \%special_headers);
 
       if($ret == -1) }

Modified: branches/upstream/libhttp-parser-xs-perl/current/XS.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/XS.xs?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/XS.xs (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/XS.xs Sun Jun 19 10:32:55 2011
@@ -186,6 +186,7 @@
   hv_store(env, "REQUEST_URI", sizeof("REQUEST_URI") - 1,
 	   newSVpvn(path, path_len), 0);
   hv_store(env, "SCRIPT_NAME", sizeof("SCRIPT_NAME") - 1, newSVpvn("", 0), 0);
+  path_len = find_ch(path, path_len, '#'); /* strip off all text after # after storing request_uri */
   question_at = find_ch(path, path_len, '?');
   if (store_url_decoded(env, "PATH_INFO", sizeof("PATH_INFO") - 1, path,
 			question_at)

Modified: branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS.pm Sun Jun 19 10:32:55 2011
@@ -19,7 +19,7 @@
     HEADERS_AS_ARRAYREF =>2,    # Ordered ArrayRef : [ name, value, name2, value2 ... ]
 };
 
-our $VERSION = '0.13';
+our $VERSION = '0.14';
 
 our $BACKEND;
 
@@ -74,7 +74,7 @@
   my %special_headers = (
     'content-length' => undef,
   );
-  my($ret, $status, $message, $headers)
+  my($ret, $minor_version, $status, $message, $headers)
     = parse_http_response($response, HEADERS_AS_ARRAYREF, \%special_headers);
 
   if($ret == -1) }

Modified: branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS/PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS/PP.pm?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS/PP.pm (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/lib/HTTP/Parser/XS/PP.pm Sun Jun 19 10:32:55 2011
@@ -47,7 +47,7 @@
     return -1 unless $http and $http =~ /^HTTP\/1\.(\d+)$/;
     $minor = $1;
 
-    my($path, $query) = ( $uri =~ /^([^?]*)(?:\?(.*))?$/s );
+    my($path, $query) = ( $uri =~ /^([^?#]*)(?:\?([^#]*))?/s );
     # following validations are just needed to pass t/01simple.t
     if ($path =~ /%(?:[0-9a-f][^0-9a-f]|[^0-9a-f][0-9a-f])/i) {
         # invalid char in url-encoded path

Modified: branches/upstream/libhttp-parser-xs-perl/current/t/01simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-parser-xs-perl/current/t/01simple.t?rev=76095&op=diff
==============================================================================
--- branches/upstream/libhttp-parser-xs-perl/current/t/01simple.t (original)
+++ branches/upstream/libhttp-parser-xs-perl/current/t/01simple.t Sun Jun 19 10:32:55 2011
@@ -1,4 +1,4 @@
-use Test::More tests => 13;
+use Test::More tests => 19;
 
 use HTTP::Parser::XS qw(parse_http_request);
 
@@ -98,3 +98,52 @@
 %env = ();
 is(parse_http_request($req, \%env), -1, 'partially url-encoded');
 is_deeply(\%env, {});
+
+# dumb HTTP client: https://github.com/miyagawa/Plack/issues/213
+$req = <<"EOT";
+GET /a/b#c HTTP/1.0\r
+\r
+EOT
+%env = ();
+is(parse_http_request($req, \%env), length($req), 'URI fragment');
+is_deeply(\%env, {
+    SCRIPT_NAME => '',
+    PATH_INFO   => '/a/b',
+    REQUEST_METHOD => 'GET',
+    REQUEST_URI    => '/a/b#c',
+    QUERY_STRING   => '',
+    SCRIPT_NAME     => '',
+    SERVER_PROTOCOL => 'HTTP/1.0',
+});
+
+$req = <<"EOT";
+GET /a/b%23c HTTP/1.0\r
+\r
+EOT
+%env = ();
+is(parse_http_request($req, \%env), length($req), '%23 -> #');
+is_deeply(\%env, {
+    SCRIPT_NAME => '',
+    PATH_INFO   => '/a/b#c',
+    REQUEST_METHOD => 'GET',
+    REQUEST_URI    => '/a/b%23c',
+    QUERY_STRING   => '',
+    SCRIPT_NAME     => '',
+    SERVER_PROTOCOL => 'HTTP/1.0',
+});
+
+$req = <<"EOT";
+GET /a/b?c=d#e HTTP/1.0\r
+\r
+EOT
+%env = ();
+is(parse_http_request($req, \%env), length($req), 'URI fragment after query string');
+is_deeply(\%env, {
+    SCRIPT_NAME => '',
+    PATH_INFO   => '/a/b',
+    REQUEST_METHOD => 'GET',
+    REQUEST_URI    => '/a/b?c=d#e',
+    QUERY_STRING   => 'c=d',
+    SCRIPT_NAME     => '',
+    SERVER_PROTOCOL => 'HTTP/1.0',
+});




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