aboutsummaryrefslogtreecommitdiffstats
path: root/examples/redirect_requests.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-11 12:13:39 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-11 12:13:39 +0200
commit7c186a4edbb0c6bc1f471d0db62dfc60008160a2 (patch)
tree89fb7e5b14cdfe9a0b61da828ddac8f355a3cdd0 /examples/redirect_requests.py
parentb62498e125191beca3b49841eb5f1fb9a93a868a (diff)
parentdd414e485212e3cab612a66d5d858c1a766ace04 (diff)
downloadmitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.tar.gz
mitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.tar.bz2
mitmproxy-7c186a4edbb0c6bc1f471d0db62dfc60008160a2.zip
Merge branch 'master' into contentviews
Diffstat (limited to 'examples/redirect_requests.py')
-rw-r--r--examples/redirect_requests.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py
index 48512f1b..ca24c42a 100644
--- a/examples/redirect_requests.py
+++ b/examples/redirect_requests.py
@@ -1,10 +1,8 @@
-from libmproxy.protocol.http import HTTPResponse
-from netlib.odict import ODictCaseless
-
"""
This example shows two ways to redirect flows to other destinations.
"""
-
+from libmproxy.models import HTTPResponse
+from netlib.http import Headers
def request(context, flow):
# pretty_host(hostheader=True) takes the Host: header of the request into account,
@@ -15,7 +13,7 @@ def request(context, flow):
if flow.request.pretty_host(hostheader=True).endswith("example.com"):
resp = HTTPResponse(
[1, 1], 200, "OK",
- ODictCaseless([["Content-Type", "text/html"]]),
+ Headers(Content_Type="text/html"),
"helloworld")
flow.reply(resp)