Bugs item #1711605, was opened at 2007-05-03 10:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1711605&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Steve Cassidy (stevecassidy)
Assigned to: Nobody/Anonymous (nobody)
Summary: CGIHttpServer leaves traces of previous requests in env

Initial Comment:
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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1711605&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to