diff Lib/test/test_httpservers.py @ 65075:2c2ba1b30823

Fix Issue9272 - Change CGIHTTPServer to give the child program a copy of os.environ
author Senthil Kumaran <orsenthil@gmail.com>
date Sun, 03 Oct 2010 17:55:45 +0000
parents 7add45bcc9c6
children b0228af6db11
line wrap: on
line diff
--- a/Lib/test/test_httpservers.py	Sun Oct 03 14:45:06 2010 +0000
+++ b/Lib/test/test_httpservers.py	Sun Oct 03 17:55:45 2010 +0000
@@ -402,6 +402,14 @@
         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):