aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-17 02:40:08 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-17 02:40:08 +0200
commit12984f149cab1308b97b5ae1bdbe375787057e7e (patch)
tree97c454cd18069f143d64992bd635a8fbd588e33b /libmproxy/protocol
parent14a5f405fdf3973f05ca11182e927d145d10d8d6 (diff)
downloadmitmproxy-12984f149cab1308b97b5ae1bdbe375787057e7e.tar.gz
mitmproxy-12984f149cab1308b97b5ae1bdbe375787057e7e.tar.bz2
mitmproxy-12984f149cab1308b97b5ae1bdbe375787057e7e.zip
move body assembly to netlib
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r--libmproxy/protocol/http.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index baccec8c..53609f26 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -91,21 +91,12 @@ class Http1Layer(_StreamingHttpLayer):
return http1.read_body(self.server_conn.rfile, expected_size, self.config.body_size_limit)
def send_response_headers(self, response):
- raw = http1.assemble_response_head(response, preserve_transfer_encoding=True)
+ raw = http1.assemble_response_head(response)
self.client_conn.wfile.write(raw)
self.client_conn.wfile.flush()
def send_response_body(self, response, chunks):
- if b"chunked" in response.headers.get(b"transfer-encoding", b"").lower():
- # TODO: Move this into netlib.http.http1
- chunks = itertools.chain(
- (
- "{:x}\r\n{}\r\n".format(len(chunk), chunk)
- for chunk in chunks if chunk
- ),
- ("0\r\n\r\n",)
- )
- for chunk in chunks:
+ for chunk in http1.assemble_body(response.headers, chunks):
self.client_conn.wfile.write(chunk)
self.client_conn.wfile.flush()