Skip to content

Commit 299fa4c

Browse files
committed
Fix Issue 10753 - Don't quote ;=, in the PATH_INFO envvar.
1 parent de3aa7f commit 299fa4c

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lib/test/test_wsgiref.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ def testReqURIs(self):
342342
self.checkReqURI("http://127.0.0.1/sp%C3%A4m", SCRIPT_NAME="/späm")
343343
self.checkReqURI("http://127.0.0.1/spammity/spam",
344344
SCRIPT_NAME="/spammity", PATH_INFO="/spam")
345+
self.checkReqURI("http://127.0.0.1/spammity/spam;ham",
346+
SCRIPT_NAME="/spammity", PATH_INFO="/spam;ham")
347+
self.checkReqURI("http://127.0.0.1/spammity/spam;cookie=1234,5678",
348+
SCRIPT_NAME="/spammity", PATH_INFO="/spam;cookie=1234,5678")
345349
self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni",
346350
SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni")
347351
self.checkReqURI("http://127.0.0.1/spammity/spam", 0,

Lib/wsgiref/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def request_uri(environ, include_query=True):
6464
"""Return the full request URI, optionally including the query string"""
6565
url = application_uri(environ)
6666
from urllib.parse import quote
67-
path_info = quote(environ.get('PATH_INFO',''))
67+
path_info = quote(environ.get('PATH_INFO',''),safe='/;=,')
6868
if not environ.get('SCRIPT_NAME'):
6969
url += path_info[1:]
7070
else:

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Core and Builtins
2020
Library
2121
-------
2222

23+
- Issue 10753 - Characters ';','=' and ',' in the PATH_INFO environment
24+
variable won't be quoted when the URI is constructed by the wsgiref.util 's
25+
request_uri method. According to RFC 3986, these characters can be a part of
26+
params in PATH component of URI and need not be quoted.
27+
2328
- Issue 10738: Fix webbrowser.Opera.raise_opts
2429

2530
- Issue 9824: SimpleCookie now encodes , and ; in values to cater to how

0 commit comments

Comments
 (0)