diff options
author | Aldo Cortesi <aldo@corte.si> | 2015-08-01 11:38:02 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2015-08-01 11:38:02 +1200 |
commit | 199f2a44fed6b5f1c6fada6c96b981dfab5fded2 (patch) | |
tree | cec2f094e20b2bf204f0420b67ba5774a47c9f50 /netlib/utils.py | |
parent | fb482172241b6235da083f6dbf154b641772a4fc (diff) | |
parent | 7b10817670b30550dd45af48491ed8cf3cacd5e6 (diff) | |
download | mitmproxy-199f2a44fed6b5f1c6fada6c96b981dfab5fded2.tar.gz mitmproxy-199f2a44fed6b5f1c6fada6c96b981dfab5fded2.tar.bz2 mitmproxy-199f2a44fed6b5f1c6fada6c96b981dfab5fded2.zip |
Merge pull request #84 from Kriechi/http2-wip
[WIP] Protocol Refactoring for HTTP/2
Diffstat (limited to 'netlib/utils.py')
-rw-r--r-- | netlib/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/netlib/utils.py b/netlib/utils.py index bee412f9..86e33f33 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -129,3 +129,13 @@ class Data(object): if not os.path.exists(fullpath): raise ValueError("dataPath: %s does not exist." % fullpath) return fullpath + + +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) |