diff options
author | Zuul <zuul@review.openstack.org> | 2018-07-26 18:30:07 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-07-26 18:30:07 +0000 |
commit | 9e84df4ed2217e8394b575c5d2d413c464c776ed (patch) | |
tree | ce6fcf2a21db78f429464a4a8ed5f03e01d67ccb | |
parent | f88d8f70ebb47882e7af7f9df5b9bd7afcdf2303 (diff) | |
parent | f15d91d1c875ea6c012d377566292662f546aa3d (diff) | |
download | python-glanceclient-9e84df4ed2217e8394b575c5d2d413c464c776ed.tar.gz |
Merge "Skip quote '=' for token header" into stable/rocky
-rw-r--r-- | glanceclient/common/http.py | 2 | ||||
-rw-r--r-- | glanceclient/tests/unit/test_http.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index b5bea8a..a5fb153 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -66,7 +66,7 @@ def encode_headers(headers): for h, v in headers.items(): if v is not None: # if the item is token, do not quote '+' as well. - safe = '+/' if h in TOKEN_HEADERS else '/' + safe = '=+/' if h in TOKEN_HEADERS else '/' if six.PY2: # incoming items may be unicode, so get them into something # the py2 version of urllib can handle before percent encoding diff --git a/glanceclient/tests/unit/test_http.py b/glanceclient/tests/unit/test_http.py index cdc1895..6eee005 100644 --- a/glanceclient/tests/unit/test_http.py +++ b/glanceclient/tests/unit/test_http.py @@ -467,11 +467,12 @@ class TestClient(testtools.TestCase): headers = self.mock.last_request.headers self.assertEqual(refreshed_token, headers['X-Auth-Token']) # regression check for bug 1448080 - unicode_token = u'ni\xf1o+' + unicode_token = u'ni\xf1o+==' http_client.auth_token = unicode_token http_client.get(path) headers = self.mock.last_request.headers # Bug #1766235: According to RFC 8187, headers must be # encoded as 7-bit ASCII, so expect to see only displayable - # chars in percent-encoding. The '+' char will be not be changed. - self.assertEqual(b'ni%C3%B1o+', headers['X-Auth-Token']) + # chars in percent-encoding. The '+' and '= 'chars will not + # be changed. + self.assertEqual(b'ni%C3%B1o+==', headers['X-Auth-Token']) |