Author v+python
Recipients v+python
Date 2010-11-21.07:50:41
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1290325843.93.0.000870454658653.issue10487@psf.upfronthosting.co.za>
In-reply-to
Content
While it is documented that http.server (and Python 2's CGIHTTPServer) do not process the status header, and limit the usefulness of CGI scripts as a result, that doesn't make it less of a bug, just a documented bug.  But I guess that it might have to be called a feature request; I'll not argue if someone switches this to feature request, but I consider it a bug.

See related issue 10482 for subprocess to provide better features for avoiding deadlock situations.  There seems to be no general way using subprocess to avoid possible deadlock situations.  However, since CGI doesn't really use stderr much, and only for logging, which the scripts can do themselves (the cgi.py module even provides for such), and because CGIs generally slurp stdin before creating stdout, it is possible to tweak sidestep use of subprocess.communicate, drop the stdout PIPE, and sequence the code to process stdin and then stdout, and not generally deadlock (some CGI scripts that don't above the stdin before stdout rule, might deadlock if called with POST and large inputs, but those are few).

By doing this, one can then add code to handle Status: headers, and avoid buffering large files on output (and on input).  The tradeoff is losing the stderr log; when that is hooked up, some error cases can trigger deadlocks by writing to stderr -- hence the subprocess issue mentioned above.
History
Date User Action Args
2010-11-21 07:50:43v+pythonsetrecipients: + v+python
2010-11-21 07:50:43v+pythonsetmessageid: <1290325843.93.0.000870454658653.issue10487@psf.upfronthosting.co.za>
2010-11-21 07:50:41v+pythonlinkissue10487 messages
2010-11-21 07:50:41v+pythoncreate