SF patch 595846 by Brett Cannon: Update environ for CGIHTTPServer.py
This patch causes CGIHTTPServer to update os.environ regardless of how it tries to handle calls (fork, popen*, etc.). Backport bugfix candidate.
This commit is contained in:
parent
0d2d87d202
commit
0bd7832285
@ -182,6 +182,7 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
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, "")
|
||||||
|
so.environ.update(env)
|
||||||
|
|
||||||
self.send_response(200, "Script output follows")
|
self.send_response(200, "Script output follows")
|
||||||
|
|
||||||
@ -221,7 +222,6 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
popenx = os.popen3
|
popenx = os.popen3
|
||||||
else:
|
else:
|
||||||
popenx = os.popen2
|
popenx = os.popen2
|
||||||
os.environ.update(env)
|
|
||||||
cmdline = scriptfile
|
cmdline = scriptfile
|
||||||
if self.is_python(scriptfile):
|
if self.is_python(scriptfile):
|
||||||
interp = sys.executable
|
interp = sys.executable
|
||||||
@ -259,7 +259,6 @@ class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# Other O.S. -- execute script in this process
|
# Other O.S. -- execute script in this process
|
||||||
os.environ.update(env)
|
|
||||||
save_argv = sys.argv
|
save_argv = sys.argv
|
||||||
save_stdin = sys.stdin
|
save_stdin = sys.stdin
|
||||||
save_stdout = sys.stdout
|
save_stdout = sys.stdout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user