summaryrefslogtreecommitdiff
path: root/oauthlib/oauth1/rfc5849/signature.py
diff options
context:
space:
mode:
authorMatt McClure <matthewlmcclure@gmail.com>2013-05-01 23:40:53 -0400
committerMatt McClure <matthewlmcclure@gmail.com>2013-05-01 23:57:10 -0400
commit0a1e428802838ea8a965f90edac144dd1f8d719a (patch)
tree4ee0c585673d75905834c08f5337cd13cbfd928d /oauthlib/oauth1/rfc5849/signature.py
parent83b353eafabcb8ad130278464128583028ebdbc9 (diff)
downloadoauthlib-0a1e428802838ea8a965f90edac144dd1f8d719a.tar.gz
Fix defect in choice of authority for signature base string
The spec <http://tools.ietf.org/html/rfc5849#section-3.4.1.2> indicates that: The host and port values MUST match the content of the HTTP request "Host" header field. Fixes https://github.com/idan/oauthlib/issues/142
Diffstat (limited to 'oauthlib/oauth1/rfc5849/signature.py')
-rw-r--r--oauthlib/oauth1/rfc5849/signature.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py
index d9d11a8..9d6fa34 100644
--- a/oauthlib/oauth1/rfc5849/signature.py
+++ b/oauthlib/oauth1/rfc5849/signature.py
@@ -99,7 +99,7 @@ def construct_base_string(http_method, base_string_uri,
return base_string
-def normalize_base_string_uri(uri):
+def normalize_base_string_uri(uri, host=None):
"""**Base String URI**
Per `section 3.4.1.2`_ of the spec.
@@ -133,7 +133,7 @@ def normalize_base_string_uri(uri):
# 1. The scheme and host MUST be in lowercase.
scheme = scheme.lower()
- netloc = netloc.lower()
+ netloc = (host or netloc).lower()
# 2. The host and port values MUST match the content of the HTTP
# request "Host" header field.