Change from checking __call__ to using callable;

https://github.com/mitmproxy/mitmproxy/issues/319
This commit is contained in:
Youhei Sakurai 2015-02-27 10:15:07 +09:00
parent 1d42c1b3c4
commit 10f81e596b
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ Responses that should be tagged for streaming by setting their respective .strea
$!example("examples/stream.py")!$
In addition, if the .stream attribute is set to callable(), .stream will work as a hook in chunk data processing.
In addition, if the .stream attribute is callable, .stream will work as a hook in chunk data processing.
$!example("examples/stream_modify.py")!$

View File

@ -1332,7 +1332,7 @@ class HTTPHandler(ProtocolHandler):
# incrementally:
h = flow.response._assemble_head(preserve_transfer_encoding=True)
self.c.client_conn.send(h)
for chunk in hasattr(flow.response.stream, "__call__") and \
for chunk in callabe(flow.response.stream) and \
flow.response.stream(http.read_http_body_chunked(self.c.server_conn.rfile,
flow.response.headers,
self.c.config.body_size_limit, flow.request.method,