[Python-bugs-list] [ python-Bugs-777848 ] CGIHTTPServer and urls

SourceForge.net noreply@sourceforge.net
Sat, 26 Jul 2003 22:01:22 -0700


Bugs item #777848, was opened at 2003-07-25 17:41
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=777848&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: vincent delft (vincent_delft)
Assigned to: Raymond Hettinger (rhettinger)
Summary: CGIHTTPServer and urls

Initial Comment:
If you have 2 differents CGI.  
On the both you ask to print the content of cgi.FieldStorage. 
 
You will see that URL paramters (after ? in the url) remains. 
 
For our example : 
1) http://localhost:8080/cgi-bin/script1.py?action=test 
Will display the parameter name 'action' and his value 'test' 
BUT, now you ask the second url 
2) http://localhost:8080/cgi-bin/script2.py 
you still see the previous parameter 'action' with the previous 
value 'test' 
 
I've resolve the problem by removing a test in the 
CGIHTTPServer.py script. 
line +- 149 
-        if query: 
-            env['QUERY_STRING'] = query 
+       env['QUERY_STRING'] = query 
 
 
Indeed, the os.environ.update(env) does not modify 
'QUERY_STRING' if you are not givin a new value.   
But in this case empty is a new value, and must be take in 
account. 
 
I don't know if my resolution is the best one.  But now it works 
like it should be. 
 
 

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-27 00:01

Message:
Logged In: YES 
user_id=80475

Will take a closer look at this one.  Initially, I was concerned 
that some CGI scripts check for the existence rather than the 
nullity of the QUERY_STRING key.  Now, I'm perplexed by 
why this isn't being handled by the for-loop (a few lines 
down from the part you patched) which "provides empty 
values to override previously set values".




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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=777848&group_id=5470