mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #17133 -- Properly handled successive slashes in incoming requests
Thanks gjanee@ucop.edu for the report and Tim Graham for the review.
This commit is contained in:
@@ -104,6 +104,22 @@ class RequestsTests(SimpleTestCase):
|
||||
})
|
||||
self.assertEqual(request.path, '/PREFIX/somepath/')
|
||||
|
||||
def test_wsgirequest_script_url_double_slashes(self):
|
||||
"""
|
||||
WSGI squashes multiple successive slashes in PATH_INFO, WSGIRequest
|
||||
should take that into account when populating request.path and
|
||||
request.META['SCRIPT_NAME'].
|
||||
Refs #17133.
|
||||
"""
|
||||
request = WSGIRequest({
|
||||
'SCRIPT_URL': '/mst/milestones//accounts/login//help',
|
||||
'PATH_INFO': '/milestones/accounts/login/help',
|
||||
'REQUEST_METHOD': 'get',
|
||||
'wsgi.input': BytesIO(b''),
|
||||
})
|
||||
self.assertEqual(request.path, '/mst/milestones/accounts/login/help')
|
||||
self.assertEqual(request.META['SCRIPT_NAME'], '/mst')
|
||||
|
||||
def test_wsgirequest_with_force_script_name(self):
|
||||
"""
|
||||
Ensure that the FORCE_SCRIPT_NAME setting takes precedence over the
|
||||
|
||||
Reference in New Issue
Block a user