[Web-SIG] Draft PEP: WSGI 1.1

Manlio Perillo manlio_perillo at libero.it
Thu Apr 15 18:30:40 CEST 2010


And Clover ha scritto:
> [...]
>> 8. The value passed to the 'write()' callback returned by
>>    'start_response()' should be a byte string. Where native strings
>>    are unicode strings, a native string type can also be supplied, in
>>    which case it would be encoded as ISO-8859-1.
> 
> Weren't we going to only allow US-ASCII for the output? (These threads
> are always so far apart I can never remember what conclusion we
> reached... if any.)
> 

By the way, yesterday I wrote some tests for Python 3.x and I found a
possible problem (only indirectly related to WSGI, however).

The example consists in a simple client -> proxy -> server, where the
client and server are in Python 2.5 and the proxy in Python 3.2
(compiled from tip, some time ago).

Here is the proxy:
http://paste.pocoo.org/show/202212/

The application fails, if cookie contains non ascii character.
The reason is that, for reasons I do not understand, http.client encode
request headers using us-ascii, instead of iso-8859-1.

The offending code is:
http://hg.python.org/cpython/file/7dcb7a2fb54d/Lib/http/client.py#l912



Regards  Manlio


More information about the Web-SIG mailing list