From 6ad8b1a15d725f34990cfe3ae650fa239171a044 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 18 Feb 2012 16:27:09 +1300 Subject: 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. --- libmproxy/flow.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'libmproxy/flow.py') 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 = "" -- cgit v1.2.3