diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-29 11:39:53 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-30 13:53:17 +0200 |
commit | a5d9e1f44dbe0fc6fee174b1953806f9b148b5ad (patch) | |
tree | 0ee53b14c3513472ea1597144b228841454eef4f /libmproxy/utils.py | |
parent | 89f22f735944989912a7a0394dd7e80d420cb0f3 (diff) | |
download | mitmproxy-a5d9e1f44dbe0fc6fee174b1953806f9b148b5ad.tar.gz mitmproxy-a5d9e1f44dbe0fc6fee174b1953806f9b148b5ad.tar.bz2 mitmproxy-a5d9e1f44dbe0fc6fee174b1953806f9b148b5ad.zip |
move code to netlib and implement protocols
Diffstat (limited to 'libmproxy/utils.py')
-rw-r--r-- | libmproxy/utils.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/libmproxy/utils.py b/libmproxy/utils.py index a29a53f5..78f74767 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -8,6 +8,7 @@ import functools import cgi import json +import netlib.utils def timestamp(): """ @@ -195,21 +196,12 @@ def parse_content_type(c): return ts[0].lower(), ts[1].lower(), d -def hostport(scheme, host, port): - """ - Returns the host component, with a port specifcation if needed. - """ - if (port, scheme) in [(80, "http"), (443, "https")]: - return host - else: - return "%s:%s" % (host, port) - def unparse_url(scheme, host, port, path=""): """ Returns a URL string, constructed from the specified compnents. """ - return "%s://%s%s" % (scheme, hostport(scheme, host, port), path) + return "%s://%s%s" % (scheme, netlib.utils.hostport(scheme, host, port), path) def clean_hanging_newline(t): |