From 444f0a4c397e3d664ce80f65d176d871b8e1194e Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 6 Jul 2016 17:31:08 -0700 Subject: py3++ --- examples/redirect_requests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/redirect_requests.py') diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py index d7db3f1c..af2aa907 100644 --- a/examples/redirect_requests.py +++ b/examples/redirect_requests.py @@ -13,9 +13,10 @@ def request(context, flow): # Method 1: Answer with a locally generated response if flow.request.pretty_host.endswith("example.com"): resp = HTTPResponse( - "HTTP/1.1", 200, "OK", + b"HTTP/1.1", 200, b"OK", Headers(Content_Type="text/html"), - "helloworld") + b"helloworld" + ) flow.reply.send(resp) # Method 2: Redirect the request to a different server -- cgit v1.2.3 From c048ae1d5b652ad4778917e624ace217e1ecfd91 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 7 Jul 2016 18:37:33 -0700 Subject: remove context from all scripts --- examples/redirect_requests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/redirect_requests.py') diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py index af2aa907..36594bcd 100644 --- a/examples/redirect_requests.py +++ b/examples/redirect_requests.py @@ -5,7 +5,7 @@ from mitmproxy.models import HTTPResponse from netlib.http import Headers -def request(context, flow): +def request(flow): # pretty_host takes the "Host" header of the request into account, # which is useful in transparent mode where we usually only have the IP # otherwise. -- cgit v1.2.3