diff options
author | Youhei Sakurai <sakurai.youhei@gmail.com> | 2015-02-27 10:15:07 +0900 |
---|---|---|
committer | Youhei Sakurai <sakurai.youhei@gmail.com> | 2015-02-27 10:15:07 +0900 |
commit | 10f81e596bc0db37c62c0326ae6f7d3891f7756c (patch) | |
tree | 49bf825e4fea1fbd42d332442de76d293276db6e | |
parent | 1d42c1b3c4f97a9e0d08bf55580b17ce144bd723 (diff) | |
download | mitmproxy-10f81e596bc0db37c62c0326ae6f7d3891f7756c.tar.gz mitmproxy-10f81e596bc0db37c62c0326ae6f7d3891f7756c.tar.bz2 mitmproxy-10f81e596bc0db37c62c0326ae6f7d3891f7756c.zip |
Change from checking __call__ to using callable;
https://github.com/mitmproxy/mitmproxy/issues/319
-rw-r--r-- | doc-src/features/responsestreaming.html | 2 | ||||
-rw-r--r-- | libmproxy/protocol/http.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/doc-src/features/responsestreaming.html b/doc-src/features/responsestreaming.html index 59847c8f..20785269 100644 --- a/doc-src/features/responsestreaming.html +++ b/doc-src/features/responsestreaming.html @@ -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")!$ diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py index fff2b84f..78c4ac80 100644 --- a/libmproxy/protocol/http.py +++ b/libmproxy/protocol/http.py @@ -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, |