aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-02-18 16:27:09 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-02-18 16:27:09 +1300
commit6ad8b1a15d725f34990cfe3ae650fa239171a044 (patch)
tree8dc1e8ea9c06d971ac2ff1b54bf766c5266176ad /libmproxy/flow.py
parenta7df6e1503551bf15c35252ffe39236221bae739 (diff)
downloadmitmproxy-6ad8b1a15d725f34990cfe3ae650fa239171a044.tar.gz
mitmproxy-6ad8b1a15d725f34990cfe3ae650fa239171a044.tar.bz2
mitmproxy-6ad8b1a15d725f34990cfe3ae650fa239171a044.zip
Firm up reverse proxy specification.
- Extract proxy spec parsing and unparsing functions. - Add a status indicator in mitmproxy. - Add the "R" keybinding for changing the reverse proxy from within mitmproxy.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index f9f1093f..81199035 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -303,13 +303,6 @@ class Request(HTTPMsg):
c.headers = self.headers.copy()
return c
- def _hostport(self):
- if (self.port, self.scheme) in [(80, "http"), (443, "https")]:
- host = self.host
- else:
- host = "%s:%s"%(self.host, self.port)
- return host
-
def get_form_urlencoded(self):
"""
Retrieves the URL-encoded form data, returning a list of (key,
@@ -352,7 +345,7 @@ class Request(HTTPMsg):
"""
Returns a URL string, constructed from the Request's URL compnents.
"""
- return "%s://%s%s"%(self.scheme, self._hostport(), self.path)
+ return utils.unparse_url(self.scheme, self.host, self.port, self.path)
def set_url(self, url):
"""
@@ -387,7 +380,7 @@ class Request(HTTPMsg):
]
)
if not 'host' in headers:
- headers["host"] = [self._hostport()]
+ headers["host"] = [utils.hostport(self.scheme, self.host, self.port)]
content = self.content
if content is None:
content = ""