This commit is contained in:
Kenneth Reitz
2012-03-18 22:15:05 -04:00
parent 613816dd9d
commit 76bf523a1f
3 changed files with 4 additions and 35 deletions
+2 -1
View File
@@ -89,4 +89,5 @@ Patches and Suggestions
- Danver Braganza <danverbraganza@gmail.com>
- Max Countryman
- Nick Chadwick
- Jonathan Drosdeck
- Jonathan Drosdeck
- Jiri Machalek
+1 -1
View File
@@ -5,7 +5,7 @@ History
+++++++++++++++++++
* Private SSL Certificate support
*
* Remove select.poll from Gevent monkeypatching
0.10.8 (2012-03-09)
+++++++++++++++++++
+1 -33
View File
@@ -683,39 +683,7 @@ class Response(object):
yield chunk
self._content_consumed = True
def generate_chunked():
resp = self.raw._original_response
fp = resp.fp
if resp.chunk_left is not None:
pending_bytes = resp.chunk_left
while pending_bytes:
chunk = fp.read(min(chunk_size, pending_bytes))
pending_bytes -= len(chunk)
yield chunk
fp.read(2) # throw away crlf
while 1:
#XXX correct line size? (httplib has 64kb, seems insane)
pending_bytes = fp.readline(40).strip()
if not len(pending_bytes):
# No content, like a HEAD request. Break out.
break
pending_bytes = int(pending_bytes, 16)
if pending_bytes == 0:
break
while pending_bytes:
chunk = fp.read(min(chunk_size, pending_bytes))
pending_bytes -= len(chunk)
yield chunk
fp.read(2) # throw away crlf
self._content_consumed = True
fp.close()
if getattr(getattr(self.raw, '_original_response', None), 'chunked', False):
gen = generate_chunked()
else:
gen = generate()
gen = stream_untransfer(gen, self)
gen = stream_untransfer(generate(), self)
if decode_unicode:
gen = stream_decode_response_unicode(gen, self)