Issue #24657: Prevent CGIRequestHandler from collapsing the URL query

Initial patch from Xiang Zhang. Also fix out-of-date _url_collapse_path() doc
string.
This commit is contained in:
Martin Panter 2015-10-03 05:55:46 +00:00
parent a02e18a43f
commit cb29e8c0e5
3 changed files with 19 additions and 4 deletions

View file

@ -565,6 +565,13 @@ class CGIHTTPServerTestCase(BaseTestCase):
(b'a=b?c=d' + self.linesep, 'text/html', 200),
(res.read(), res.getheader('Content-type'), res.status))
def test_query_with_continuous_slashes(self):
res = self.request('/cgi-bin/file4.py?k=aa%2F%2Fbb&//q//p//=//a//b//')
self.assertEqual(
(b'k=aa%2F%2Fbb&//q//p//=//a//b//' + self.linesep,
'text/html', 200),
(res.read(), res.getheader('Content-type'), res.status))
class SocketlessRequestHandler(SimpleHTTPRequestHandler):
def __init__(self):