mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Catch sendfile failure from no file descriptor
If the filelike response object has no `fileno` attribute, then skip trying to use sendfile rather than failing with an error. Close #1160
This commit is contained in:
parent
960d5ef7cc
commit
98c9e3b375
@ -355,6 +355,10 @@ class Response(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
fileno = respiter.filelike.fileno()
|
fileno = respiter.filelike.fileno()
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
offset = os.lseek(fileno, 0, os.SEEK_CUR)
|
offset = os.lseek(fileno, 0, os.SEEK_CUR)
|
||||||
if self.response_length is None:
|
if self.response_length is None:
|
||||||
filesize = os.fstat(fileno).st_size
|
filesize = os.fstat(fileno).st_size
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user