summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlieryan <lie.1296@gmail.com>2014-09-22 16:32:20 +1000
committerLie Ryan <ryan.l@thegaminglab.com>2014-09-22 16:41:26 +1000
commit92e3595c8fce478d84187340b9f0eb3ae67273bd (patch)
tree9fa2c5aee9af4f36e71946779e0ccd049424d9ae
parentec67aba9d62d0e32dc5154c940a2214441bf0a9e (diff)
downloadwebob-92e3595c8fce478d84187340b9f0eb3ae67273bd.tar.gz
Fix optional and bad whitespace parsing in auth-param
-rw-r--r--tests/test_descriptors.py4
-rw-r--r--webob/descriptors.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_descriptors.py b/tests/test_descriptors.py
index e37246a..7bf229f 100644
--- a/tests/test_descriptors.py
+++ b/tests/test_descriptors.py
@@ -576,6 +576,10 @@ def test_parse_auth_params_truncate_on_comma():
def test_parse_auth_params_emptystr():
from webob.descriptors import parse_auth_params
eq_(parse_auth_params(''), {})
+
+def test_parse_auth_params_bad_whitespace():
+ from webob.descriptors import parse_auth_params
+ eq_(parse_auth_params('a= "2 ", b =3, c=4 '), {'a': '2 ', 'b': '3', 'c': '4'})
def test_authorization2():
from webob.descriptors import parse_auth_params
diff --git a/webob/descriptors.py b/webob/descriptors.py
index 8d3ca25..c191e33 100644
--- a/webob/descriptors.py
+++ b/webob/descriptors.py
@@ -303,7 +303,7 @@ def serialize_content_range(value):
-_rx_auth_param = re.compile(r'([a-z]+)=(".*?"|[^,]*)(?:\Z|, *)')
+_rx_auth_param = re.compile(r'([a-z]+)[ \t]*=[ \t]*(".*?"|[^,]*?)[ \t]*(?:\Z|, *)')
def parse_auth_params(params):
r = {}