[Patches] [ python-Patches-796772 ] CGIHTTPServer fix

SourceForge.net noreply at sourceforge.net
Mon Jan 12 14:14:15 EST 2004


Patches item #796772, was opened at 2003-08-28 12:34
Message generated for change (Settings changed) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=796772&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: CGIHTTPServer fix

Initial Comment:
Here's a fix for the CGI server. The problem only
occurs on systems that support os.fork(). When you
invoke a CGI script with a query string and then
subsequent invoke it without a query string (or with an
empty query string), the second invocation gets passed
the query string of the first invocation. This is
because of the way os.environ is updated in the parent,
but when there is no query string, the old query string
doesn't get deleted. The solution is to update the
os.environ in the child.

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

Comment By: Martin v. Löwis (loewis)
Date: 2003-09-10 02:12

Message:
Logged In: YES 
user_id=21627

I agree with rhettinger. The original patch assumes that the
platform has putenv/setenv, which it might not (if it
doesn't, then the os.environ.update is not reflected in the
C environment, and thus has no effect on os.execv).

Whether or not os.environ needs to be copied is debatable;
the copying has its cost, but avoiding the putenv calls
would save some of the costs.

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-08-31 10:48

Message:
Logged In: YES 
user_id=80475

The first part of the patch makes sense to me.
The second part updates os.environ which is shared between 
successive calls.  I would have expected something like:

   childenv = os.environ.copy()
   childenv.update(env)
    . . .
   os.execve(scriptfile, args, childenv)

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

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



More information about the Patches mailing list