fix nonblocking example

this fixes #3877
This commit is contained in:
Maximilian Hils 2020-04-03 17:18:35 +02:00 committed by GitHub
parent e9ab1debea
commit c56ca19d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ from mitmproxy import ctx
@concurrent # Remove this and see what happens
def request(flow):
# You don't want to use mitmproxy.ctx from a different thread
ctx.log.info("handle request: %s%s" % (flow.request.host, flow.request.path))
# This is ugly in mitmproxy's UI, but you don't want to use mitmproxy.ctx.log from a different thread.
print("handle request: %s%s" % (flow.request.host, flow.request.path))
time.sleep(5)
ctx.log.info("start request: %s%s" % (flow.request.host, flow.request.path))
print("start request: %s%s" % (flow.request.host, flow.request.path))