summaryrefslogtreecommitdiff
path: root/tests/requests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-10-23 14:53:32 +0200
committerClaude Paroz <claude@2xlibre.net>2015-10-23 22:18:18 +0200
commit10ace52a41fc3458fb7df51d11974b398f0fbde3 (patch)
tree475b4aaca7072f766ab3b30e9806ec009f302bc4 /tests/requests
parent494b7986a3e5996d857b085f188a630d1504d9ca (diff)
Fixed #17133 -- Properly handled successive slashes in incoming requests
Thanks gjanee@ucop.edu for the report and Tim Graham for the review.
Diffstat (limited to 'tests/requests')
-rw-r--r--tests/requests/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 0b6254d0bb..66fe8c92ec 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -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