diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-17 02:14:14 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-17 02:14:14 +0200 |
commit | dad9f06cb9403ac88d31d0ba8422034df2bc5078 (patch) | |
tree | d69ea509a4cfd9549f4a602966bd9309f8853b3c /netlib/http/http1/assemble.py | |
parent | e1659f3fcf83b5993b776a4ef3d2de70fbe27aa2 (diff) | |
download | mitmproxy-dad9f06cb9403ac88d31d0ba8422034df2bc5078.tar.gz mitmproxy-dad9f06cb9403ac88d31d0ba8422034df2bc5078.tar.bz2 mitmproxy-dad9f06cb9403ac88d31d0ba8422034df2bc5078.zip |
organize exceptions, improve content-length handling
Diffstat (limited to 'netlib/http/http1/assemble.py')
-rw-r--r-- | netlib/http/http1/assemble.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/netlib/http/http1/assemble.py b/netlib/http/http1/assemble.py index ace25d79..33b9ef25 100644 --- a/netlib/http/http1/assemble.py +++ b/netlib/http/http1/assemble.py @@ -95,9 +95,9 @@ def _assemble_response_headers(response, preserve_transfer_encoding=False): if not preserve_transfer_encoding: headers.pop(b"Transfer-Encoding", None) - # If body is defined (i.e. not None or CONTENT_MISSING), we always - # add a content-length header. - if response.body or response.body == b"": - headers[b"Content-Length"] = str(len(response.body)).encode("ascii") + # If body is defined (i.e. not None or CONTENT_MISSING), + # we now need to set a content-length header. + if response.body or response.body == b"": + headers[b"Content-Length"] = str(len(response.body)).encode("ascii") return bytes(headers) |