e0539fb2e7
Resolves: rhbz#1113529
35 lines
1.5 KiB
Diff
35 lines
1.5 KiB
Diff
# HG changeset patch
|
|
# User Benjamin Peterson <benjamin@python.org>
|
|
# Date 1402796473 25200
|
|
# Node ID 847e288d6e93dba049c280f40979e16a1378d0f6
|
|
# Parent 6f1f387759913d91cb307d2783b3a40c48fe7424# Parent 5676797f3a3eccaf38e2c500e77ed39c68923cc9
|
|
merge 3.3 (#21766)
|
|
|
|
diff --git a/Lib/http/server.py b/Lib/http/server.py
|
|
--- a/Lib/http/server.py
|
|
+++ b/Lib/http/server.py
|
|
@@ -977,7 +977,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRe
|
|
(and the next character is a '/' or the end of the string).
|
|
|
|
"""
|
|
- collapsed_path = _url_collapse_path(self.path)
|
|
+ collapsed_path = _url_collapse_path(urllib.parse.unquote(self.path))
|
|
dir_sep = collapsed_path.find('/', 1)
|
|
head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
|
|
if head in self.cgi_directories:
|
|
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
|
|
--- a/Lib/test/test_httpservers.py
|
|
+++ b/Lib/test/test_httpservers.py
|
|
@@ -485,6 +485,11 @@ class CGIHTTPServerTestCase(BaseTestCase
|
|
(res.read(), res.getheader('Content-type'), res.status))
|
|
self.assertEqual(os.environ['SERVER_SOFTWARE'], signature)
|
|
|
|
+ def test_urlquote_decoding_in_cgi_check(self):
|
|
+ res = self.request('/cgi-bin%2ffile1.py')
|
|
+ self.assertEqual((b'Hello World\n', 'text/html', 200),
|
|
+ (res.read(), res.getheader('Content-type'), res.status))
|
|
+
|
|
|
|
class SocketlessRequestHandler(SimpleHTTPRequestHandler):
|
|
def __init__(self):
|