New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CGIHttpServer leaves traces of previous requests in env #44922
Comments
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 |
Can you provide a patch? |
I don't see why it modifies os.environ at all environ it passed as argument to child subprocess. |
I can't edit my comment. That suxx. It should be |
bpo-9272 has a patch. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: