aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/http.py
diff options
context:
space:
mode:
authorMarcelo Glezer <mg@tekii.com.ar>2015-03-02 14:37:30 -0300
committerMarcelo Glezer <mg@tekii.com.ar>2015-03-02 14:37:30 -0300
commit8008a4336d85f4d34bd9f192c5f3e510f4adf5cd (patch)
tree02240bbd5a5abcff275e2d841252c1b86a32f6eb /libmproxy/protocol/http.py
parentbd6c3f64c1f3102a4e91d4a964757821773781e0 (diff)
parente65a8659f00fb949d15f9af9fefd72df48abe9af (diff)
downloadmitmproxy-8008a4336d85f4d34bd9f192c5f3e510f4adf5cd.tar.gz
mitmproxy-8008a4336d85f4d34bd9f192c5f3e510f4adf5cd.tar.bz2
mitmproxy-8008a4336d85f4d34bd9f192c5f3e510f4adf5cd.zip
Merge pull request #2 from mitmproxy/master
update to mitmproxy/master
Diffstat (limited to 'libmproxy/protocol/http.py')
-rw-r--r--libmproxy/protocol/http.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 046d0b42..49310ec3 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -1332,10 +1332,19 @@ class HTTPHandler(ProtocolHandler):
# incrementally:
h = flow.response._assemble_head(preserve_transfer_encoding=True)
self.c.client_conn.send(h)
- for chunk in http.read_http_body_chunked(self.c.server_conn.rfile,
- flow.response.headers,
- self.c.config.body_size_limit, flow.request.method,
- flow.response.code, False, 4096):
+
+ chunks = http.read_http_body_chunked(
+ self.c.server_conn.rfile,
+ flow.response.headers,
+ self.c.config.body_size_limit,
+ flow.request.method,
+ flow.response.code,
+ False,
+ 4096
+ )
+ if callable(flow.response.stream):
+ chunks = flow.response.stream(chunks)
+ for chunk in chunks:
for part in chunk:
self.c.client_conn.wfile.write(part)
self.c.client_conn.wfile.flush()