aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-03 23:44:54 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-03 23:44:54 +0200
commit2f44b26b4cd014e03dd62a125d79af9b81663a93 (patch)
tree732a02fe5d0283ccd98513bfaa2c8d65bb81dd54 /examples/redirect_requests.py
parentcd43c5ba9c2981aeffee354cbcb574b6f5e435ba (diff)
downloadmitmproxy-2f44b26b4cd014e03dd62a125d79af9b81663a93.tar.gz
mitmproxy-2f44b26b4cd014e03dd62a125d79af9b81663a93.tar.bz2
mitmproxy-2f44b26b4cd014e03dd62a125d79af9b81663a93.zip
improve HTTPRequest syntax
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index a9a7e795..b57df2b2 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -7,12 +7,12 @@ This example shows two ways to redirect flows to other destinations.
def request(context, flow):
- if flow.request.get_host(hostheader=True).endswith("example.com"):
+ if flow.request.pretty_host(hostheader=True).endswith("example.com"):
resp = HTTPResponse(
[1, 1], 200, "OK",
ODictCaseless([["Content-Type", "text/html"]]),
"helloworld")
flow.request.reply(resp)
- if flow.request.get_host(hostheader=True).endswith("example.org"):
+ if flow.request.pretty_host(hostheader=True).endswith("example.org"):
flow.request.host = "mitmproxy.org"
- flow.request.headers["Host"] = ["mitmproxy.org"]
+ flow.request.update_host_header()