Commit dbecb2e2 authored by Jason Madden's avatar Jason Madden

Clarify the test for #712 and add a changelog.

parent 336ed4d3
......@@ -22,6 +22,10 @@
Reported in :issue:`704` by Shaun Crampton.
- PyPy: Optimize the CFFI backend to use less memory (two pointers per
watcher).
- Python 3: The WSGI ``PATH_INFO`` entry is decoded from URL escapes
using latin-1, not UTF-8. This improves compliance with PEP 333 and
compatibility with some frameworks like Django. Fixed in :pr:`712`
by Ruben De Visscher.
1.1rc2 (Dec 11, 2015)
=====================
......
......@@ -956,6 +956,8 @@ class WSGIHandler(object):
path, query = self.path.split('?', 1)
else:
path, query = self.path, ''
# Note that self.path contains the original str object; if it contains
# encoded escapes, it will NOT match PATH_INFO.
env['PATH_INFO'] = unquote_latin1(path)
env['QUERY_STRING'] = query
......
......@@ -728,10 +728,12 @@ class TestInternational(TestCase):
validator = None # wsgiref.validate.IteratorWrapper([]) does not have __len__
def application(self, environ, start_response):
if not PY3:
self.assertEqual(environ['PATH_INFO'], '/\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82')
else:
self.assertEqual(environ['PATH_INFO'], '/\u043f\u0440\u0438\u0432\u0435\u0442'.encode('utf-8').decode('latin-1'))
path_bytes = b'/\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82'
if PY3:
# Under PY3, the escapes were decoded as latin-1
path_bytes = path_bytes.decode('latin-1')
self.assertEqual(environ['PATH_INFO'], path_bytes)
self.assertEqual(environ['QUERY_STRING'], '%D0%B2%D0%BE%D0%BF%D1%80%D0%BE%D1%81=%D0%BE%D1%82%D0%B2%D0%B5%D1%82')
start_response("200 PASSED", [('Content-Type', 'text/plain')])
return []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment