[Web-SIG] wsgiref 0.2 dev in svn w/PEP 3333 support
And Clover
and-py at doxdesk.com
Wed Oct 6 13:28:45 CEST 2010
On 10/05/2010 04:23 AM, P.J. Eby wrote:
> A preliminary update of the standalone (Python <3.x) version of wsgiref
> is now available
Is there any interest in putting fixup code into wsgiref's CGIHandler? I
appreciate this is really ugly, but the CGI-to-WSGI gateway is the most
logical place for this, as otherwise the WSGI environment created by
CGIHandler often doesn't meet the requirements of the spec.
Trying to fix these problems at an application, framework or middleware
level is impractical because they don't know that the WSGI environ
originally came from CGI. (And they can't re-read the environ at that
point without breaking environ-altering middleware.)
In particular: for Python 2.x running on Win32, read the environment
using ctypes where available, allowing non-ASCII characters to be read
directly instead of irretrievably mangled by the ANSI-code-page-encoded
os.environ interface. Then encode the extracted Unicode environ to byte
strings using ISO-8859-1, except if the server software is
Microsoft/IIS, where the encoding will probably be UTF-8.
IIS also needs a fix to remove the duplicated SCRIPT_NAME from the front
of PATH_INFO. This is a bit more risky as existing apps/libraries may
already be doing this and might get confused if someone's already done
the fix. Maybe a subclass like IISCGIHandler?
--
And Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/
More information about the Web-SIG
mailing list