diff options
author | Valentin Bartenev <vbart@nginx.com> | 2019-09-17 18:40:21 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2019-09-17 18:40:21 +0300 |
commit | 6352c21a58d66db99f8f981c37e6d57e62fc24a2 (patch) | |
tree | 6c9c4a5bf510d5847b7f5667b8195bac79410b52 /test | |
parent | 3b77e402a903d9f7a6eeb32f7930d8979f8e0c9e (diff) | |
download | unit-6352c21a58d66db99f8f981c37e6d57e62fc24a2.tar.gz unit-6352c21a58d66db99f8f981c37e6d57e62fc24a2.tar.bz2 |
HTTP parser: fixed parsing of target after literal space character.
In theory, all space characters in request target must be encoded; however,
some clients may violate the specification. For the sake of interoperability,
Unit supports unencoded space characters.
Previously, if there was a space character before the extension or arguments
parts, those parts weren't recognized. Also, quoted symbols and complex
target weren't detected after a space character.
Diffstat (limited to '')
-rw-r--r-- | test/test_python_application.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_python_application.py b/test/test_python_application.py index 1f366570..5b6e2089 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -71,6 +71,37 @@ class TestPythonApplication(TestApplicationPython): 'Query-String header', ) + def test_python_application_query_string_space(self): + self.load('query_string') + + resp = self.get(url='/ ?var1=val1&var2=val2') + self.assertEqual( + resp['headers']['Query-String'], + 'var1=val1&var2=val2', + 'Query-String space', + ) + + resp = self.get(url='/ %20?var1=val1&var2=val2') + self.assertEqual( + resp['headers']['Query-String'], + 'var1=val1&var2=val2', + 'Query-String space 2', + ) + + resp = self.get(url='/ %20 ?var1=val1&var2=val2') + self.assertEqual( + resp['headers']['Query-String'], + 'var1=val1&var2=val2', + 'Query-String space 3', + ) + + resp = self.get(url='/blah %20 blah? var1= val1 & var2=val2') + self.assertEqual( + resp['headers']['Query-String'], + ' var1= val1 & var2=val2', + 'Query-String space 4', + ) + def test_python_application_query_string_empty(self): self.load('query_string') |