[New-bugs-announce] [issue20138] wsgiref on Python 3.x incorrectly implements URL handling causing mangled Unicode

Armin Ronacher report at bugs.python.org
Mon Jan 6 10:46:59 CET 2014


New submission from Armin Ronacher:

I just noticed through looking through someone else's WSGI framework that wsgiref is incorrectly handling URL handling.  It does not go through the WSGI coding dance in the wsgiref.utils.request_uri function.

Testcase through werkzeug:

>>> from wsgiref.util import request_uri
>>> from werkzeug.test import create_environ
>>> from werkzeug.urls import url_parse, url_unquote
>>> env = create_environ('/\N{SNOWMAN}')
>>> url_parse(request_uri(env)).path
'/%C3%A2%C2%98%C2%83'
>>> url_unquote(url_parse(request_uri(env)).path)
'/â\x98\x83'
>>> _ == '/\N{SNOWMAN}'
False

If this passes tests then I'm assuming that wsgiref is doing the inverse bug somewhere else.  I will look into it later, but this behavior is definitely broken.

----------
messages: 207418
nosy: aronacher
priority: normal
severity: normal
status: open
title: wsgiref on Python 3.x incorrectly implements URL handling causing mangled Unicode

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20138>
_______________________________________


More information about the New-bugs-announce mailing list