Fix Issue9272 - Change CGIHTTPServer to give the child program a copy of os.environ

This commit is contained in:
Senthil Kumaran 2010-10-03 17:55:45 +00:00
parent 388f956c35
commit 4271372a71
2 changed files with 13 additions and 4 deletions

View file

@ -402,6 +402,14 @@ def test_no_leading_slash(self):
self.assertEqual((b'Hello World\n', 'text/html', 200),
(res.read(), res.getheader('Content-type'), res.status))
def test_os_environ_is_not_altered(self):
signature = "Test CGI Server"
os.environ['SERVER_SOFTWARE'] = signature
res = self.request('/cgi-bin/file1.py')
self.assertEqual((b'Hello World\n', 'text/html', 200),
(res.read(), res.getheader('Content-type'), res.status))
self.assertEqual(os.environ['SERVER_SOFTWARE'], signature)
class SocketlessRequestHandler(SimpleHTTPRequestHandler):
def __init__(self):