cpython: 0e19f421dc9e (original) (raw)

--- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -284,6 +284,7 @@ class SimpleHTTPServerTestCase(BaseTestC self.data = b'We are the knights who say Ni!' self.tempdir = tempfile.mkdtemp(dir=basetempdir) self.tempdir_name = os.path.basename(self.tempdir)

@@ -330,7 +331,7 @@ class SimpleHTTPServerTestCase(BaseTestC filename = os.fsdecode(support.TESTFN_UNDECODABLE) + '.txt' with open(os.path.join(self.tempdir, filename), 'wb') as f: f.write(support.TESTFN_UNDECODABLE)

@@ -344,27 +345,27 @@ class SimpleHTTPServerTestCase(BaseTestC .encode(enc, 'surrogateescape'), body) self.assertIn(('>%s<' % html.escape(filename)) .encode(enc, 'surrogateescape'), body)

def test_get(self): #constructs the path relative to the root directory of the HTTPServer

@@ -373,7 +374,7 @@ class SimpleHTTPServerTestCase(BaseTestC data = b"Dummy index file\r\n" with open(os.path.join(self.tempdir_name, 'index.html'), 'wb') as f: f.write(data)

# chmod() doesn't work as expected on Windows, and filesystem @@ -381,14 +382,14 @@ class SimpleHTTPServerTestCase(BaseTestC if os.name == 'posix' and os.geteuid() != 0: os.chmod(self.tempdir, 0) try:

def test_head(self): response = self.request(

@@ -404,6 +405,22 @@ class SimpleHTTPServerTestCase(BaseTestC response = self.request('/', method='GETs') self.check_status_and_reason(response, HTTPStatus.NOT_IMPLEMENTED)

+ cgi_file1 = """[](#l1.103) #!%s