mirror of
https://github.com/django/django.git
synced 2025-03-31 19:46:42 +00:00
Refs #17133 -- Optimized script_url handling in get_script_name
10ace52a added some regex processing for each request with SCRIPT_URL set. In a speed critical section, conditionally apply of the regex will save some resources.
This commit is contained in:
parent
c4b4a7430b
commit
ea2f48ce8b
@ -221,9 +221,10 @@ def get_script_name(environ):
|
|||||||
script_url = get_bytes_from_wsgi(environ, 'REDIRECT_URL', '')
|
script_url = get_bytes_from_wsgi(environ, 'REDIRECT_URL', '')
|
||||||
|
|
||||||
if script_url:
|
if script_url:
|
||||||
# mod_wsgi squashes multiple successive slashes in PATH_INFO,
|
if b'//' in script_url:
|
||||||
# do the same with script_url before manipulating paths (#17133).
|
# mod_wsgi squashes multiple successive slashes in PATH_INFO,
|
||||||
script_url = _slashes_re.sub(b'/', script_url)
|
# do the same with script_url before manipulating paths (#17133).
|
||||||
|
script_url = _slashes_re.sub(b'/', script_url)
|
||||||
path_info = get_bytes_from_wsgi(environ, 'PATH_INFO', '')
|
path_info = get_bytes_from_wsgi(environ, 'PATH_INFO', '')
|
||||||
script_name = script_url[:-len(path_info)] if path_info else script_url
|
script_name = script_url[:-len(path_info)] if path_info else script_url
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user