[Bps-public-commit] r11137 - in HTTP-Server-Simple: . lib/HTTP/Server/Simple/CGI

alexmv at bestpractical.com alexmv at bestpractical.com
Thu Mar 20 15:40:07 EDT 2008


Author: alexmv
Date: Thu Mar 20 15:40:05 2008
New Revision: 11137

Modified:
   HTTP-Server-Simple/   (props changed)
   HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
   HTTP-Server-Simple/t/04cgi.t

Log:
 r28682 at kohr-ah:  chmrr | 2008-03-20 15:38:58 -0400
  * At least Apache and lighttpd put unencoded strings into PATH_INFO,
    so so should we.


Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm	(original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm	Thu Mar 20 15:40:05 2008
@@ -82,6 +82,9 @@
         }
     }
 
+    # Apache and lighttpd both do one layer of unescaping on
+    # path_info; we should duplicate that.
+    $ENV{PATH_INFO} = URI::Escape::uri_unescape($ENV{PATH_INFO});
 }
 
 =head2  header

Modified: HTTP-Server-Simple/t/04cgi.t
==============================================================================
--- HTTP-Server-Simple/t/04cgi.t	(original)
+++ HTTP-Server-Simple/t/04cgi.t	Thu Mar 20 15:40:05 2008
@@ -2,7 +2,7 @@
 use Socket;
 use strict;
 
-plan tests => 21;
+plan tests => 22;
 my $PORT = 8000 + $$;
 
 my $host = gethostbyaddr(inet_aton('localhost'), AF_INET);
@@ -61,10 +61,17 @@
 
   like(
        fetch("GET /cgitest/REQUEST_URI?foo%3Fbar",""),
-       "/foo%3Fbar/",
+       qr/foo%3Fbar/,
        "Didn't decode already"
       );
 
+  like(
+       fetch("GET /cgitest/foo%2Fbar/PATH_INFO",""),
+       qr|foo/bar|,
+       "Did decode already"
+      );
+
+
   is(kill(9,$pid),1,'Signaled 1 process successfully');
   wait or die "counldn't wait for sub-process completion";
 }



More information about the Bps-public-commit mailing list