From: Martin Panter Date: Sat, 3 Oct 2015 06:03:25 +0000 (+0000) Subject: Issues #25232, #24657: Merge two CGI server fixes from 3.4 into 3.5 X-Git-Tag: v3.5.1rc1~219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56b76d25dda22ed4d0a66b50e914920a4791f664;p=thirdparty%2FPython%2Fcpython.git Issues #25232, #24657: Merge two CGI server fixes from 3.4 into 3.5 --- 56b76d25dda22ed4d0a66b50e914920a4791f664 diff --cc Lib/test/test_httpservers.py index 518e38ec3d11,6e5f2db7fdd3..50244c6ab1d5 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@@ -602,10 -556,22 +620,23 @@@ class CGIHTTPServerTestCase(BaseTestCas def test_nested_cgi_path_issue21323(self): res = self.request('/cgi-bin/child-dir/file3.py') - self.assertEqual((b'Hello World' + self.linesep, 'text/html', 200), - (res.read(), res.getheader('Content-type'), res.status)) + self.assertEqual( + (b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK), + (res.read(), res.getheader('Content-type'), res.status)) + def test_query_with_multiple_question_mark(self): + res = self.request('/cgi-bin/file4.py?a=b?c=d') + self.assertEqual( + (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): diff --cc Misc/ACKS index 6999c0909c79,9e2c57de7afd..3b5f600cbfb8 --- a/Misc/ACKS +++ b/Misc/ACKS @@@ -1577,9 -1529,9 +1577,10 @@@ Gordon Worle Darren Worrall Thomas Wouters Daniel Wozniak +Wei Wu Heiko Wundram Doug Wyatt + Xiang Zhang Robert Xiao Florent Xicluna Hirokazu Yamamoto diff --cc Misc/NEWS index 9a9b39bf2a75,1c8bc491e656..37b3d396b375 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -34,9 -90,12 +34,15 @@@ Core and Builtin Library ------- + - Issue #25232: Fix CGIRequestHandler to split the query from the URL at the + first question mark (?) rather than the last. Patch from Xiang Zhang. + + - Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the + query part of the URL as if it were a path. Patch from Xiang Zhang. + +- Issue #24483: C implementation of functools.lru_cache() now calculates key's + hash only once. + - Issue #22958: Constructor and update method of weakref.WeakValueDictionary now accept the self and the dict keyword arguments.