本文整理匯總了Python中gunicorn.http.wsgi.sendfile方法的典型用法代碼示例。如果您正苦於以下問題:Python wsgi.sendfile方法的具體用法?Python wsgi.sendfile怎麽用?Python wsgi.sendfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gunicorn.http.wsgi
的用法示例。
在下文中一共展示了wsgi.sendfile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _eventlet_sendfile
# 需要導入模塊: from gunicorn.http import wsgi [as 別名]
# 或者: from gunicorn.http.wsgi import sendfile [as 別名]
def _eventlet_sendfile(fdout, fdin, offset, nbytes):
while True:
try:
return o_sendfile(fdout, fdin, offset, nbytes)
except OSError as e:
if e.args[0] == errno.EAGAIN:
trampoline(fdout, write=True)
else:
raise
示例2: patch_sendfile
# 需要導入模塊: from gunicorn.http import wsgi [as 別名]
# 或者: from gunicorn.http.wsgi import sendfile [as 別名]
def patch_sendfile():
from gunicorn.http import wsgi
if o_sendfile is not None:
setattr(wsgi, "sendfile", _eventlet_sendfile)
示例3: _gevent_sendfile
# 需要導入模塊: from gunicorn.http import wsgi [as 別名]
# 或者: from gunicorn.http.wsgi import sendfile [as 別名]
def _gevent_sendfile(fdout, fdin, offset, nbytes):
while True:
try:
return o_sendfile(fdout, fdin, offset, nbytes)
except OSError as e:
if e.args[0] == errno.EAGAIN:
wait_write(fdout)
else:
raise
示例4: patch_sendfile
# 需要導入模塊: from gunicorn.http import wsgi [as 別名]
# 或者: from gunicorn.http.wsgi import sendfile [as 別名]
def patch_sendfile():
from gunicorn.http import wsgi
if o_sendfile is not None:
setattr(wsgi, "sendfile", _gevent_sendfile)