mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix content length. Test iff size == 0 before we start the loop.
This commit is contained in:
parent
0beb39412d
commit
c52e30bcef
@ -113,11 +113,13 @@ class LengthReader(object):
|
|||||||
def read(self, size):
|
def read(self, size):
|
||||||
if not isinstance(size, (int, long)):
|
if not isinstance(size, (int, long)):
|
||||||
raise TypeError("size must be an integral type")
|
raise TypeError("size must be an integral type")
|
||||||
|
|
||||||
|
size = min(self.length, size)
|
||||||
if size < 0:
|
if size < 0:
|
||||||
raise ValueError("Size must be positive.")
|
raise ValueError("Size must be positive.")
|
||||||
if size == 0:
|
if size == 0:
|
||||||
return ""
|
return ""
|
||||||
size = min(self.length, size)
|
|
||||||
|
|
||||||
buf = StringIO()
|
buf = StringIO()
|
||||||
data = self.unreader.read()
|
data = self.unreader.read()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user