cpython: 815a4ac67e68 (original) (raw)
Mercurial > cpython
changeset 101032:815a4ac67e68
Issue #26717: Merge wsgiref fix from 3.5 [#26717]
Martin Panter vadmium+py@gmail.com | |
---|---|
date | Sun, 17 Apr 2016 02:36:50 +0000 |
parents | 3e93ac5a7afa(current diff)1f2cfcd5a83f(diff) |
children | 19356c6d23b9 |
files | Lib/wsgiref/simple_server.py Misc/ACKS Misc/NEWS |
diffstat | 4 files changed, 29 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_wsgiref.py 24 Lib/wsgiref/simple_server.py 2 Misc/ACKS 1 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -1,3 +1,4 @@ +from unittest import mock from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers @@ -221,6 +222,29 @@ class IntegrationTests(TestCase): b"data", out)
- def test_cp1252_url(self):
def app(e, s):[](#l1.13)
s("200 OK", [[](#l1.14)
("Content-Type", "text/plain"),[](#l1.15)
("Date", "Wed, 24 Dec 2008 13:29:32 GMT"),[](#l1.16)
])[](#l1.17)
# PEP3333 says environ variables are decoded as latin1.[](#l1.18)
# Encode as latin1 to get original bytes[](#l1.19)
return [e["PATH_INFO"].encode("latin1")][](#l1.20)
out, err = run_amock([](#l1.22)
validator(app), data=b"GET /\x80%80 HTTP/1.0")[](#l1.23)
self.assertEqual([](#l1.24)
[[](#l1.25)
b"HTTP/1.0 200 OK",[](#l1.26)
mock.ANY,[](#l1.27)
b"Content-Type: text/plain",[](#l1.28)
b"Date: Wed, 24 Dec 2008 13:29:32 GMT",[](#l1.29)
b"",[](#l1.30)
b"/\x80\x80",[](#l1.31)
],[](#l1.32)
out.splitlines())[](#l1.33)
+ class UtilityTests(TestCase):
--- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -82,7 +82,7 @@ class WSGIRequestHandler(BaseHTTPRequest else: path,query = self.path,''
env['PATH_INFO'] = urllib.parse.unquote_to_bytes(path).decode('iso-8859-1')[](#l2.7)
env['PATH_INFO'] = urllib.parse.unquote(path, 'iso-8859-1')[](#l2.8) env['QUERY_STRING'] = query[](#l2.9)
--- a/Misc/ACKS +++ b/Misc/ACKS @@ -1385,6 +1385,7 @@ Nir Soffer Paul Sokolovsky Evgeny Sologubov Cody Somerville +Anthony Sottile Edoardo Spadolini Geoffrey Spear Clay Spence
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -245,6 +245,9 @@ Core and Builtins Library ------- +- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by