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.

classification
Title: cgi.CGIHTTPRequestHandler remembers QUERY_STRING
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: fidlej, georg.brandl, loewis, rhettinger
Priority: normal Keywords:

Created on 2003-09-07 13:44 by fidlej, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (4)
msg18089 - (view) Author: Ivo Danihelka (fidlej) Date: 2003-09-07 13:44
Python 2.3+, Debian SID:
cgi.CGIHTTPRequestHandler remembers QUERY_STRING from
last query.
If query is '', then condition "if query:" fails and
env['QUERY_STRING'] is remembered from last query.

Solution:
--- /usr/lib/python2.3/CGIHTTPServer.py 2003-09-07
15:33:41.000000000 +0200
+++ CGIHTTPServer.py    2003-09-07 15:36:27.000000000 +0200
@@ -147,8 +147,7 @@
         env['PATH_INFO'] = uqrest
         env['PATH_TRANSLATED'] =
self.translate_path(uqrest)
         env['SCRIPT_NAME'] = scriptname
-        if query:
-            env['QUERY_STRING'] = query
+        env['QUERY_STRING'] = query
         host = self.address_string()
         if host != self.client_address[0]:
             env['REMOTE_HOST'] = host


msg18090 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-09-07 19:48
Logged In: YES 
user_id=21627

I believe the bug lies elsewhere: If we have fork, we
shouldn't set the environment variables in the parent
process, but only in the child process.
msg18091 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-09-10 03:40
Logged In: YES 
user_id=80475

See the patch at www.python.org/sf/796772
msg18092 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-25 20:02
Logged In: YES 
user_id=1188172

This is a duplicate of #777848, closing as such.
History
Date User Action Args
2022-04-10 16:11:03adminsetgithub: 39196
2003-09-07 13:44:30fidlejcreate