diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-11 12:13:39 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-11 12:13:39 +0200 |
commit | 7c186a4edbb0c6bc1f471d0db62dfc60008160a2 (patch) | |
tree | 89fb7e5b14cdfe9a0b61da828ddac8f355a3cdd0 /examples/change_upstream_proxy.py | |
parent | b62498e125191beca3b49841eb5f1fb9a93a868a (diff) | |
parent | dd414e485212e3cab612a66d5d858c1a766ace04 (diff) | |
download | mitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.tar.gz mitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.tar.bz2 mitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.zip |
Merge branch 'master' into contentviews
Diffstat (limited to 'examples/change_upstream_proxy.py')
-rw-r--r-- | examples/change_upstream_proxy.py | 12 |
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 |