This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stevecassidy
Recipients
Date 2007-05-03.00:28:37
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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
History
Date User Action Args
2007-08-23 14:53:32adminlinkissue1711605 messages
2007-08-23 14:53:32admincreate