aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/semantics.py
diff options
context:
space:
mode:
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