aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/utils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-02-18 14:45:22 +1300
committerAldo Cortesi <aldo@nullcube.com>2012-02-18 14:45:22 +1300
commita7df6e1503551bf15c35252ffe39236221bae739 (patch)
tree86b55ce06498f5ad347e8995b13a7419332240e5 /libmproxy/utils.py
parentacdc2d00b4779a8c67107794a2bc66d66036c268 (diff)
downloadmitmproxy-a7df6e1503551bf15c35252ffe39236221bae739.tar.gz
mitmproxy-a7df6e1503551bf15c35252ffe39236221bae739.tar.bz2
mitmproxy-a7df6e1503551bf15c35252ffe39236221bae739.zip
Refactor reverse proxying
- Retain the specification from the Host header as a Request's description. - Expand upstream proxy specifications to include the scheme. We now say https://hostname:port - Move the "R" revert keybinding to "v" to make room for a reverse proxy binding that matches the command-line flag.
Diffstat (limited to 'libmproxy/utils.py')
-rw-r--r--libmproxy/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/libmproxy/utils.py b/libmproxy/utils.py
index c12ccc9b..f0e31145 100644
--- a/libmproxy/utils.py
+++ b/libmproxy/utils.py
@@ -161,7 +161,6 @@ def del_all(dict, keys):
del dict[key]
-
def pretty_size(size):
suffixes = [
("B", 2**10),
@@ -421,6 +420,13 @@ def parse_url(url):
return scheme, host, port, path
+def parse_proxy_spec(url):
+ p = parse_url(url)
+ if not p:
+ return None
+ return p[:3]
+
+
def clean_hanging_newline(t):
"""
Many editors will silently add a newline to the final line of a