aboutsummaryrefslogtreecommitdiffstats
path: root/examples/change_upstream_proxy.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-03 18:25:36 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-03 18:25:36 +0200
commit99126f62ed947847eba4cfa687cb0b0f012092bb (patch)
tree7f3332a8335b1c48d9749f0d5330b16fb229ba4b /examples/change_upstream_proxy.py
parent8da683a638a6f67db5b55d2089eb0601074793b2 (diff)
downloadmitmproxy-99126f62ed947847eba4cfa687cb0b0f012092bb.tar.gz
mitmproxy-99126f62ed947847eba4cfa687cb0b0f012092bb.tar.bz2
mitmproxy-99126f62ed947847eba4cfa687cb0b0f012092bb.zip
remove depth attribute from set_server
Diffstat (limited to 'examples/change_upstream_proxy.py')
-rw-r--r--examples/change_upstream_proxy.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/examples/change_upstream_proxy.py b/examples/change_upstream_proxy.py
index 8f58e1f2..9c454897 100644
--- a/examples/change_upstream_proxy.py
+++ b/examples/change_upstream_proxy.py
@@ -4,7 +4,6 @@
# Usage: mitmdump -U http://default-upstream-proxy.local:8080/ -s change_upstream_proxy.py
#
# If you want to change the target server, you should modify flow.request.host and flow.request.port
-# flow.live.set_server should only be used by inline scripts to change the upstream proxy.
def proxy_address(flow):
@@ -22,13 +21,4 @@ def request(context, flow):
return
address = proxy_address(flow)
if flow.live:
- if flow.request.scheme == "http":
- # For a normal HTTP request, we just change the proxy server and we're done!
- if address != flow.live.server_conn.address:
- flow.live.set_server(address, depth=1)
- else:
- # If we have CONNECTed (and thereby established "destination state"), the story is
- # a bit more complex. Now we don't want to change the top level address (which is
- # the connect destination) but the address below that. (Notice the `.via` and depth=2).
- if address != flow.live.server_conn.via.address:
- flow.live.set_server(address, depth=2)
+ flow.live.change_upstream_proxy_server(address) \ No newline at end of file