Kaydet (Commit) e8b993ab authored tarafından Darren Shepherd's avatar Darren Shepherd

Use requests to read chunk data instead of parsing the raw stream

The previous code had a bug in which it assumed that the chunk data had
no newlines in it.  In 0.9.0 newlines were added to the stream results,
which exposed this bug.
üst d0985b02
......@@ -233,17 +233,8 @@ class Client(requests.Session):
def _stream_helper(self, response):
"""Generator for data coming from a chunked-encoded HTTP response."""
socket_fp = self._get_raw_response_socket(response)
socket_fp.setblocking(1)
socket = socket_fp.makefile()
while True:
size = int(socket.readline(), 16)
if size <= 0:
break
data = socket.readline()
if not data:
break
yield data
for line in response.iter_lines(chunk_size=32):
yield line
def _multiplexed_buffer_helper(self, response):
"""A generator of multiplexed data blocks read from a buffered
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment