Fix for SF 777848.

I've been bitten by this myself in the past half year.
I hope this fix is right.
I'll backport this to 2.3.
This commit is contained in:
Guido van Rossum 2004-03-20 22:18:03 +00:00
parent 27f49610af
commit 70ec0b42b5
1 changed files with 5 additions and 6 deletions

View File

@ -177,12 +177,11 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
if co: if co:
env['HTTP_COOKIE'] = ', '.join(co) env['HTTP_COOKIE'] = ', '.join(co)
# XXX Other HTTP_* headers # XXX Other HTTP_* headers
if not self.have_fork: # Since we're setting the env in the parent, provide empty
# Since we're setting the env in the parent, provide empty # values to override previously set values
# values to override previously set values for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'):
'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "")
env.setdefault(k, "")
os.environ.update(env) os.environ.update(env)
self.send_response(200, "Script output follows") self.send_response(200, "Script output follows")