mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri()
functions now conform to PEP 3333 when handle non-ASCII URLs.
This commit is contained in:
parent
55c9e0366e
commit
0abbe8c090
3 changed files with 11 additions and 4 deletions
|
|
@ -57,14 +57,14 @@ def application_uri(environ):
|
|||
if environ['SERVER_PORT'] != '80':
|
||||
url += ':' + environ['SERVER_PORT']
|
||||
|
||||
url += quote(environ.get('SCRIPT_NAME') or '/')
|
||||
url += quote(environ.get('SCRIPT_NAME') or '/', encoding='latin1')
|
||||
return url
|
||||
|
||||
def request_uri(environ, include_query=True):
|
||||
"""Return the full request URI, optionally including the query string"""
|
||||
url = application_uri(environ)
|
||||
from urllib.parse import quote
|
||||
path_info = quote(environ.get('PATH_INFO',''),safe='/;=,')
|
||||
path_info = quote(environ.get('PATH_INFO',''), safe='/;=,', encoding='latin1')
|
||||
if not environ.get('SCRIPT_NAME'):
|
||||
url += path_info[1:]
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue