Issue 1711605: CGIHttpServer leaves traces of previous requests in env (original) (raw)

Issue1711605

Created on 2007-05-03 00:28 by stevecassidy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg31931 - (view) Author: Steve Cassidy (stevecassidy) Date: 2007-05-03 00:28
CGIHttpserver tries to reset the environment between calls to CGI scripts by setting various variables to '' if they are not needed in the current request. In some cases this is not the correct behaviour since the presence of a null value can be interpreted by a CGI script as being significant. For example, if HTTP_COOKIE has a null value then a script doing the standard test: if os.environ.has_key('HTTP_COOKIE'): # get the cookie will have trouble The problem is that CGIHTTPserver.py resets the entries in the env array which is then passed to os.environ.update(), this can only overwrite the env variables, not remove them. An alternative is to call if os.environ.has_key(k): del os.environ[k] inside the loop that updates the empty keys, then these variables will not be passed on to the CGI script. Steve
msg31932 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-05-08 19:07
Can you provide a patch?
msg107914 - (view) Author: anatoly techtonik (techtonik) Date: 2010-06-16 11:56
I don't see why it modifies os.environ at all environ it passed as argument to child subprocess.
msg107915 - (view) Author: anatoly techtonik (techtonik) Date: 2010-06-16 11:58
I can't edit my comment. That suxx. It should be "...at all if environ is passed..."
msg112182 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-31 19:10
#9272 has a patch.
History
Date User Action Args
2022-04-11 14:56:24 admin set github: 44922
2010-07-31 19:10:34 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + superseder: CGIHTTPServer poisons os.environresolution: duplicate
2010-06-16 11:58:10 techtonik set messages: +
2010-06-16 11:56:45 techtonik set nosy: + techtonikmessages: +
2009-04-22 05:08:06 ajaksu2 set keywords: + easy
2009-03-31 20:58:48 dugan set nosy: + dugan
2009-03-30 16:49:37 ajaksu2 set stage: test neededtype: behaviorcomponents: + Library (Lib), - Extension Modulesversions: + Python 2.6, Python 3.0, - Python 2.5
2007-05-03 00:28:37 stevecassidy create