aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/semantics.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-07-15 22:32:14 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-07-22 15:30:51 +0200
commitbab6cbff1e5444aea72a188d57812130c375e0f0 (patch)
tree5b33c11cf076a099a039fa8e8494acf5b1eff07e /netlib/http/semantics.py
parentf50deb7b763d093a22a4d331e16465a2fb0329cf (diff)
downloadmitmproxy-bab6cbff1e5444aea72a188d57812130c375e0f0.tar.gz
mitmproxy-bab6cbff1e5444aea72a188d57812130c375e0f0.tar.bz2
mitmproxy-bab6cbff1e5444aea72a188d57812130c375e0f0.zip
extract authentication methods from protocol
Diffstat (limited to 'netlib/http/semantics.py')
-rw-r--r--netlib/http/semantics.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/netlib/http/semantics.py b/netlib/http/semantics.py
index e7e84fe3..a62c93e3 100644
--- a/netlib/http/semantics.py
+++ b/netlib/http/semantics.py
@@ -49,7 +49,6 @@ def is_valid_host(host):
return True
-
def parse_url(url):
"""
Returns a (scheme, host, port, path) tuple, or None on error.
@@ -92,3 +91,16 @@ def parse_url(url):
if not is_valid_port(port):
return None
return scheme, host, port, path
+
+
+def get_header_tokens(headers, key):
+ """
+ Retrieve all tokens for a header key. A number of different headers
+ follow a pattern where each header line can containe comma-separated
+ tokens, and headers can be set multiple times.
+ """
+ toks = []
+ for i in headers[key]:
+ for j in i.split(","):
+ toks.append(j.strip())
+ return toks