aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-05 15:16:20 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-05 15:16:20 +0200
commit2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0 (patch)
tree755d8cf7f6578c9346e9f3c68604615177cf9332 /examples/redirect_requests.py
parentf2570c773aa18e4ac236b1cf7f43acfb4ca080dd (diff)
downloadmitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.tar.gz
mitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.tar.bz2
mitmproxy-2a6337343a14f7f72c28d8bf5f24220f6d9ca6d0.zip
update docs, mostly revert 2f44b26b4cd014e03dd62a125d79af9b81663a93
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index cc642039..c5561839 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -6,7 +6,9 @@ This example shows two ways to redirect flows to other destinations.
"""
-def request(context, flow):
+def request(ctx, flow):
+ # pretty_host(hostheader=True) takes the Host: header of the request into account,
+ # which is useful in transparent mode where we usually only have the IP otherwise.
if flow.request.pretty_host(hostheader=True).endswith("example.com"):
resp = HTTPResponse(
[1, 1], 200, "OK",