cpython: 544b654d000c (original) (raw)

Mercurial > cpython

changeset 86779:544b654d000c 3.3

merge 3.2 (#19435) [#19435]

Benjamin Peterson benjamin@python.org
date Wed, 30 Oct 2013 12:50:18 -0400
parents 7fa3e824a4ee(current diff)dda1a32748e0(diff)
children 493a99acaf00 518cb39bb625
files Lib/http/server.py Lib/test/test_httpservers.py Misc/NEWS
diffstat 3 files changed, 17 insertions(+), 5 deletions(-)[+] [-] Lib/http/server.py 9 Lib/test/test_httpservers.py 12 Misc/NEWS 1

line wrap: on

line diff

--- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -987,18 +987,17 @@ class CGIHTTPRequestHandler(SimpleHTTPRe def run_cgi(self): """Execute a CGI script."""

scriptdir = self.translate_path(nextdir) if os.path.isdir(scriptdir): dir, rest = nextdir, nextrest

--- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -325,6 +325,7 @@ class CGIHTTPServerTestCase(BaseTestCase self.parent_dir = tempfile.mkdtemp() self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin') os.mkdir(self.cgi_dir)

@@ -345,6 +346,11 @@ class CGIHTTPServerTestCase(BaseTestCase self.tearDown() self.skipTest("Python executable path is not encodable to utf-8")

+ self.file1_path = os.path.join(self.cgi_dir, 'file1.py') with open(self.file1_path, 'w', encoding='utf-8') as file1: file1.write(cgi_file1 % self.pythonexe) @@ -362,6 +368,8 @@ class CGIHTTPServerTestCase(BaseTestCase os.chdir(self.cwd) if self.pythonexe != sys.executable: os.remove(self.pythonexe)

@@ -418,6 +426,10 @@ class CGIHTTPServerTestCase(BaseTestCase self.assertEqual((b'Hello World' + self.linesep, 'text/html', 200), (res.read(), res.getheader('Content-type'), res.status))

+ def test_post(self): params = urllib.parse.urlencode( {'spam' : 1, 'eggs' : 'python', 'bacon' : 123456})

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,7 @@ Core and Builtins Library ------- +- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. What's New in Python 3.3.3 release candidate 1?