1 message in org.python.python-bugs-list[ python-Bugs-777848 ] CGIHTTPServer ...
FromSent OnAttachments
SourceForge.netMar 20, 2004 5:28 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[ python-Bugs-777848 ] CGIHTTPServer and urlsActions...
From:SourceForge.net (nore@sourceforge.net)
Date:Mar 20, 2004 5:28:53 pm
List:org.python.python-bugs-list

Bugs item #777848, was opened at 2003-07-25 18:41 Message generated for change (Comment added) made by gvanrossum 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: Closed Resolution: Fixed

Priority: 5 Submitted By: vincent delft (vincent_delft) Assigned to: Guido van Rossum (gvanrossum) 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: Guido van Rossum (gvanrossum)

Date: 2004-03-20 17:29

Message: Logged In: YES user_id=6380

Fixed in CVS for 2.4; will also for for 2.3.

I think I just had a black-out when I added the "if not have_fork" test.

Note to vincent_delft: setdefault() only changes the value if no value is already set, so it does exactly what we want.

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

Comment By: Raymond Hettinger (rhettinger) Date: 2003-08-17 13:09

Message: Logged In: YES user_id=80475

Guido, is there a reason that you had excluded default setting when have_fork is true?

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

Comment By: vincent delft (vincent_delft) Date: 2003-07-27 07:53

Message: Logged In: YES user_id=106404

I don't see the for-loop ? If you are talking about the following : if not self.have_fork: # Since we're setting the env in the parent, provide empty # values to override previously set values for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "")

It's normal that he not used because I'm on Linux machine. So, I have fork capabilities. Honestly I don't understand this loop. Indeed, You set to default values that was defined just before. In general we set the default before.

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

Comment By: Raymond Hettinger (rhettinger) Date: 2003-07-27 01: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".

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