mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix readline in tee
This commit is contained in:
parent
ac74d5079d
commit
cf7322ca43
@ -34,8 +34,8 @@ class TeeInput(object):
|
||||
chunk, self.buf = parser.filter_body(buf)
|
||||
if chunk:
|
||||
self.tmp.write(chunk)
|
||||
self.tmp.seek(0)
|
||||
self._finalize()
|
||||
self.tmp.seek(0)
|
||||
|
||||
@property
|
||||
def len(self):
|
||||
@ -93,12 +93,18 @@ class TeeInput(object):
|
||||
|
||||
# now we can get line
|
||||
line = self.tmp.readline()
|
||||
if size > 0 and len(line) < size:
|
||||
self.tmp.seek(orig_size)
|
||||
i = line.find("\n")
|
||||
if i == -1:
|
||||
while True:
|
||||
orig_size = self.tmp.tell()
|
||||
if not self._tee(CHUNK_SIZE):
|
||||
self.tmp.seek(orig_size)
|
||||
return self.temp.readline(size)
|
||||
break
|
||||
self.tmp.seek(orig_size)
|
||||
line = self.tmp.readline()
|
||||
i = line.find("\n")
|
||||
if i != -1:
|
||||
break
|
||||
|
||||
return line
|
||||
|
||||
def readlines(self, sizehint=0):
|
||||
@ -132,7 +138,8 @@ class TeeInput(object):
|
||||
self.tmp.seek(0, os.SEEK_END)
|
||||
return chunk
|
||||
|
||||
if self.parser.body_eof(): break
|
||||
if self.parser.body_eof():
|
||||
break
|
||||
|
||||
data = read_partial(self.socket, length)
|
||||
self.buf += data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user