diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-29 11:27:43 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-29 11:27:43 +0200 |
commit | c7fcc2cca5ff85641febbb908d11d22336bbd81c (patch) | |
tree | 5344d505a5a4c771702c6ef5689a04268bb6b30d /netlib/utils.py | |
parent | 827fe824d97d96779512c8a4032d9b30d516d63f (diff) | |
download | mitmproxy-c7fcc2cca5ff85641febbb908d11d22336bbd81c.tar.gz mitmproxy-c7fcc2cca5ff85641febbb908d11d22336bbd81c.tar.bz2 mitmproxy-c7fcc2cca5ff85641febbb908d11d22336bbd81c.zip |
add on-the-wire representation methods
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) |