]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Two changes suggested by Jan Pieter Riegel:
authorGuido van Rossum <guido@python.org>
Wed, 28 Apr 1999 12:21:47 +0000 (12:21 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 28 Apr 1999 12:21:47 +0000 (12:21 +0000)
(1) Fix reference to pwd.error to be KeyError -- there is no pwd.error
and pwd.getpwnam() raises KeyError on failure.

(2) Add cookie support, by placing the 'Cookie:' header, if present,
in the HTTP_COOKIE environment variable.

Lib/CGIHTTPServer.py

index 806ef575556f373f50012340fcfacd7ad707afac..66c4c9c41b9585c28594a8438ec82aa58851fb16 100644 (file)
@@ -150,6 +150,9 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
             ua = self.headers.getheader('user-agent')
             if ua:
                 env['HTTP_USER_AGENT'] = ua
+            co = self.headers.getheader('cookie')
+            if co:
+                env['HTTP_COOKIE'] = co
             # XXX Other HTTP_* headers
             decoded_query = string.replace(query, '+', ' ')
             try:
@@ -177,7 +180,7 @@ def nobody_uid():
     import pwd
     try:
         nobody = pwd.getpwnam('nobody')[2]
-    except pwd.error:
+    except KeyError:
         nobody = 1 + max(map(lambda x: x[2], pwd.getpwall()))
     return nobody