summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-04-28 12:21:47 (GMT)
committerGuido van Rossum <guido@python.org>1999-04-28 12:21:47 (GMT)
commit630b811676c24bd3c15df9484c3e73c500fbf746 (patch)
treecef3ffbc3b06ec43b1c293316a5c499e72dab9e9
parenta8acf72afa2a057cc72b86420e4ee3e17aece142 (diff)
downloadcpython-630b811676c24bd3c15df9484c3e73c500fbf746.zip
cpython-630b811676c24bd3c15df9484c3e73c500fbf746.tar.gz
cpython-630b811676c24bd3c15df9484c3e73c500fbf746.tar.bz2
Two changes suggested by Jan Pieter Riegel:
(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.
-rw-r--r--Lib/CGIHTTPServer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index 806ef57..66c4c9c 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -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