Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
50dd1f7d
Commit
50dd1f7d
authored
Apr 17, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8
Patch by Anthony Sottile.
parent
06172e7b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
Lib/test/test_wsgiref.py
Lib/test/test_wsgiref.py
+24
-0
Lib/wsgiref/simple_server.py
Lib/wsgiref/simple_server.py
+1
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_wsgiref.py
View file @
50dd1f7d
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
):
s
(
"200 OK"
,
[
(
"Content-Type"
,
"text/plain"
),
(
"Date"
,
"Wed, 24 Dec 2008 13:29:32 GMT"
),
])
# PEP3333 says environ variables are decoded as latin1.
# Encode as latin1 to get original bytes
return
[
e
[
"PATH_INFO"
].
encode
(
"latin1"
)]
out
,
err
=
run_amock
(
validator
(
app
),
data
=
b"GET /
\
x80
%80 HTTP/1.0"
)
self
.
assertEqual
(
[
b"HTTP/1.0 200 OK"
,
mock
.
ANY
,
b"Content-Type: text/plain"
,
b"Date: Wed, 24 Dec 2008 13:29:32 GMT"
,
b""
,
b"/
\
x80
\
x80
"
,
],
out
.
splitlines
())
class
UtilityTests
(
TestCase
):
...
...
Lib/wsgiref/simple_server.py
View file @
50dd1f7d
...
...
@@ -82,7 +82,7 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
else
:
path
,
query
=
self
.
path
,
''
env
[
'PATH_INFO'
]
=
urllib
.
parse
.
unquote
_to_bytes
(
path
).
decode
(
'iso-8859-1'
)
env
[
'PATH_INFO'
]
=
urllib
.
parse
.
unquote
(
path
,
'iso-8859-1'
)
env
[
'QUERY_STRING'
]
=
query
host
=
self
.
address_string
()
...
...
Misc/ACKS
View file @
50dd1f7d
...
...
@@ -1376,6 +1376,7 @@ Nir Soffer
Paul Sokolovsky
Evgeny Sologubov
Cody Somerville
Anthony Sottile
Edoardo Spadolini
Geoffrey Spear
Clay Spence
...
...
Misc/NEWS
View file @
50dd1f7d
...
...
@@ -107,6 +107,9 @@ Core and Builtins
Library
-------
- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by
Anthony Sottile.
- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading
more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of
1024 bytes per call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment