Merge pull request #878 from warting/patch-1

Update redirect_requests.py
This commit is contained in:
Maximilian Hils 2016-01-08 17:33:03 +01:00
commit f07008b8a6

View File

@ -12,11 +12,11 @@ def request(context, flow):
# Method 1: Answer with a locally generated response
if flow.request.pretty_host.endswith("example.com"):
resp = HTTPResponse(
[1, 1], 200, "OK",
"HTTP/1.1", 200, "OK",
Headers(Content_Type="text/html"),
"helloworld")
flow.reply(resp)
# Method 2: Redirect the request to a different server
if flow.request.pretty_host.endswith("example.org"):
flow.request.host = "mitmproxy.org"
flow.request.host = "mitmproxy.org"