diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-07-21 14:02:56 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-07-21 14:02:56 +0200 |
commit | 254a6862358af9d7d98bf443e310f659532d918d (patch) | |
tree | 71b0b3a2eb502e7ea2235701cb6ae6a133c7f372 /netlib/http.py | |
parent | 6bd5df79f82a33b7e725afb5f279bda4cba41935 (diff) | |
parent | d382bb27bf4732def621cddb46fc4cc1d2143ab4 (diff) | |
download | mitmproxy-254a6862358af9d7d98bf443e310f659532d918d.tar.gz mitmproxy-254a6862358af9d7d98bf443e310f659532d918d.tar.bz2 mitmproxy-254a6862358af9d7d98bf443e310f659532d918d.zip |
Merge branch 'master' into stream
Conflicts:
netlib/http.py
Diffstat (limited to 'netlib/http.py')
-rw-r--r-- | netlib/http.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/netlib/http.py b/netlib/http.py index f88e6652..774bac6c 100644 --- a/netlib/http.py +++ b/netlib/http.py @@ -288,6 +288,11 @@ def parse_response_line(line): def read_response(rfile, request_method, body_size_limit, include_body=True): """ Return an (httpversion, code, msg, headers, content) tuple. + + By default, both response header and body are read. + If include_body=False is specified, content may be one of the following: + - None, if the response is technically allowed to have a response body + - "", if the response must not have a response body (e.g. it's a response to a HEAD request) """ line = rfile.readline() if line == "\r\n" or line == "\n": # Possible leftover from previous message @@ -368,7 +373,7 @@ def expected_http_body_size(headers, is_request, request_method, response_code): - -1, if all data should be read until end of stream. """ - # Determine response size according to http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-16#section-3.3 + # Determine response size according to http://tools.ietf.org/html/rfc7230#section-3.3 if request_method: request_method = request_method.upper() @@ -390,4 +395,4 @@ def expected_http_body_size(headers, is_request, request_method, response_code): raise HttpError(400 if is_request else 502, "Invalid content-length header: %s" % headers["content-length"]) if is_request: return 0 - return -1
\ No newline at end of file + return -1 |