Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions deproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ def __repr__(self):
self.orphaned_handlings))


def read_body_from_stream(stream, headers):
if ('Transfer-Encoding' in headers and
def read_body_from_stream(stream, headers, method):
if method == "HEAD": # no body
body = None
elif ('Transfer-Encoding' in headers and
headers['Transfer-Encoding'] not in ['identity', 'chunked']):
# 2
logger.debug('NotImplementedError - Transfer-Encoding not in "identity", "chunked"')
Expand Down Expand Up @@ -604,7 +606,7 @@ def send_request(self, scheme, host, request):
logger.debug(' %s: %s', k, v)

logger.debug('Reading body')
body = read_body_from_stream(rfile, response_headers)
body = read_body_from_stream(rfile, response_headers, request.method)

logger.debug('Creating Response object')
response = Response(code, message, response_headers, body)
Expand Down Expand Up @@ -1071,7 +1073,7 @@ def parse_request(self, rfile, wfile):
persistent_connection = True

logger.debug('reading body')
body = read_body_from_stream(rfile, headers)
body = read_body_from_stream(rfile, headers, method)

logger.debug('returning')
return (Request(method, path, headers, body), persistent_connection)
Expand Down