aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/http.py')
-rw-r--r--netlib/http.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/netlib/http.py b/netlib/http.py
index f5b8118a..21cde538 100644
--- a/netlib/http.py
+++ b/netlib/http.py
@@ -292,7 +292,7 @@ def parse_response_line(line):
return (proto, code, msg)
-def read_response(rfile, method, body_size_limit):
+def read_response(rfile, method, body_size_limit, include_body=True):
"""
Return an (httpversion, code, msg, headers, content) tuple.
"""
@@ -315,8 +315,10 @@ def read_response(rfile, method, body_size_limit):
# Parse response body according to http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-16#section-3.3
if method in ["HEAD", "CONNECT"] or (code in [204, 304]) or 100 <= code <= 199:
content = ""
- else:
+ elif include_body:
content = read_http_body(rfile, headers, body_size_limit, False)
+ else:
+ content = None # if include_body==False then a None content means the body should be read separately
return httpversion, code, msg, headers, content