To: python-list@cwi.nl
Date: 13 May 98 18:33:11 GMT
I think I found a bug in CGIHTTPServer.py. (Does anyone care? :-)
I was trying to use it as the web server for uploading files.
Python CGI scripts (using the CGI module) that worked for other
servers (e.g., Netscape Enterprise server) hang when run from
CGIHTTPServer. The problem is that the content type parameters,
in particular the boundary parameter, were not passed through to
the CGI scripts, thus making the MIME parsing code choke.
My simple-minded fix is:
% diff CGIHTTPServer.py /usr/local/lib/python1.5/CGIHTTPServer.py
137,140c136
< if self.headers.typeheader is None:
< env['CONTENT_TYPE'] = self.headers.type
< else:
< env['CONTENT_TYPE'] = self.headers.typeheader
---
> env['CONTENT_TYPE'] = self.headers.type
Conrad
This patch must hold the world record for living in my inbox:
From: John Ehresman <jehresma@dsg.harvard.edu>
Date: Wed, 23 Aug 1995 16:07:11 -0400
He provided a fix for the version that comes with Python 1.3:
ftpmirror.py revision 1.1... And it was still relevant!
Adapted from code submitted by Just van Rossum.
PySys_WriteStdout(format, ...)
PySys_WriteStderr(format, ...)
The first function writes to sys.stdout; the second to sys.stderr. When
there is a problem, they write to the real (C level) stdout or stderr;
no exceptions are raised (but a pending exception may be cleared when a
new exception is caught).
Both take a printf-style format string as their first argument followed
by a variable length argument list determined by the format string.
*** WARNING ***
The format should limit the total size of the formatted output string to
1000 bytes. In particular, this means that no unrestricted "%s" formats
should occur; these should be limited using "%.<N>s where <N> is a
decimal number calculated so that <N> plus the maximum size of other
formatted text does not exceed 1000 bytes. Also watch out for "%f",
which can print hundreds of digits for very large numbers.
the one from Override.pm (part of latex2html).
Absolutize the TEXINPUTS environment variable, since we can't count on
latex2html doing it for us (even though I sent in a patch, and it really
should).
- When facility not specified to syslog() method, use default from openlog()
(This is how it was claimed to work in the documentation)
- Potential resource leak of o_ident, now cleaned up in closelog()
- Minor comment accuracy fix.