]> granicus.if.org Git - python/commitdiff
Fix Issue 10753 - Don't quote ;=, in the PATH_INFO envvar.
authorSenthil Kumaran <orsenthil@gmail.com>
Wed, 29 Dec 2010 06:25:42 +0000 (06:25 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Wed, 29 Dec 2010 06:25:42 +0000 (06:25 +0000)
Lib/test/test_wsgiref.py
Lib/wsgiref/util.py
Misc/NEWS

index 8051b4a0813dcdf1d2b5210b08f5f84e75da4c82..b8cf635129087917f569b6d5f3ac1993ed69bca5 100644 (file)
@@ -342,6 +342,10 @@ class UtilityTests(TestCase):
         self.checkReqURI("http://127.0.0.1/sp%C3%A4m", SCRIPT_NAME="/späm")
         self.checkReqURI("http://127.0.0.1/spammity/spam",
             SCRIPT_NAME="/spammity", PATH_INFO="/spam")
+        self.checkReqURI("http://127.0.0.1/spammity/spam;ham",
+            SCRIPT_NAME="/spammity", PATH_INFO="/spam;ham")
+        self.checkReqURI("http://127.0.0.1/spammity/spam;cookie=1234,5678",
+            SCRIPT_NAME="/spammity", PATH_INFO="/spam;cookie=1234,5678")
         self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni",
             SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni")
         self.checkReqURI("http://127.0.0.1/spammity/spam", 0,
index ae982f059116a13f3ce7f3f5fe1d1858a661014b..1f1e6cce1798942f5341881bbfc6293050ef10d0 100644 (file)
@@ -64,7 +64,7 @@ def request_uri(environ, include_query=True):
     """Return the full request URI, optionally including the query string"""
     url = application_uri(environ)
     from urllib.parse import quote
-    path_info = quote(environ.get('PATH_INFO',''))
+    path_info = quote(environ.get('PATH_INFO',''),safe='/;=,')
     if not environ.get('SCRIPT_NAME'):
         url += path_info[1:]
     else:
index 530fcc79e27ec17e8d31ebc6aaf71ab6b7b901c8..b4e4cf96f88d8cd1748045c5d85e27e88c7145bb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -20,6 +20,11 @@ Core and Builtins
 Library
 -------
 
+- Issue 10753 - Characters ';','=' and ',' in the PATH_INFO environment
+  variable won't be quoted when the URI is constructed by the wsgiref.util 's
+  request_uri method. According to RFC 3986, these characters can be a part of
+  params in PATH component of URI and need not be quoted.
+
 - Issue 10738: Fix webbrowser.Opera.raise_opts
 
 - Issue 9824: SimpleCookie now encodes , and ; in values to cater to how