mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
should fix _ensure_length in tee. while I'm here fix chunked response.
This commit is contained in:
parent
29fd1cf48f
commit
c2f12a4977
@ -37,13 +37,12 @@ class Parser(object):
|
||||
with new headers.
|
||||
"""
|
||||
|
||||
ld = len("\r\n\r\n")
|
||||
s = "".join(buf)
|
||||
i = s.find("\r\n\r\n")
|
||||
if i != -1:
|
||||
if i > 0:
|
||||
r = s[:i]
|
||||
pos = i+ld
|
||||
pos = i+4
|
||||
return self.finalize_headers(headers, r, pos)
|
||||
return -1
|
||||
|
||||
@ -119,8 +118,7 @@ class Parser(object):
|
||||
@property
|
||||
def is_chunked(self):
|
||||
""" is TE: chunked ?"""
|
||||
transfert_encoding = self.headers_dict.get('Transfer-Encoding', False)
|
||||
return (transfert_encoding == "chunked")
|
||||
return (self.headers_dict.get('Transfer-Encoding') == "chunked")
|
||||
|
||||
@property
|
||||
def content_len(self):
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# This file is part of gunicorn released under the MIT license.
|
||||
# See the NOTICE for more information.
|
||||
|
||||
from gunicorn.util import http_date, write, close
|
||||
from gunicorn.util import close, http_date, write, write_chunk
|
||||
|
||||
class Response(object):
|
||||
|
||||
|
||||
@ -155,7 +155,9 @@ class TeeInput(object):
|
||||
def _ensure_length(self, buf, length):
|
||||
if not buf or not self._len:
|
||||
return buf
|
||||
while len(buf) < length and self.len != self.tmp.tell():
|
||||
while True:
|
||||
if len(buf) >= length:
|
||||
break
|
||||
data = self._tee(length - len(buf))
|
||||
if not data: break
|
||||
buf += data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user