mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Allow disabling sendfile via an environment variable
add support for the `SENDFILE` environment variable. fix #1252
This commit is contained in:
parent
fed56176e5
commit
d5a07ce4ff
@ -192,6 +192,17 @@ class Config(object):
|
||||
|
||||
return env
|
||||
|
||||
@property
|
||||
def sendfile(self):
|
||||
if self.settings['sendfile'].get() is not None:
|
||||
return False
|
||||
|
||||
if 'SENDFILE' in os.environ:
|
||||
sendfile = os.environ['SENDFILE'].lower()
|
||||
return sendfile in ['y', '1', 'yes', 'true']
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class SettingMeta(type):
|
||||
def __new__(cls, name, bases, attrs):
|
||||
@ -836,13 +847,19 @@ class Sendfile(Setting):
|
||||
validator = validate_bool
|
||||
action = "store_const"
|
||||
const = False
|
||||
|
||||
desc = """\
|
||||
Disables the use of ``sendfile()``.
|
||||
|
||||
If not set, the value of the ``SENDFILE`` environment variable is used
|
||||
to enable or disable its usage.
|
||||
|
||||
.. versionadded:: 19.2
|
||||
.. versionchanged:: 19.4
|
||||
Swapped ``--sendfile`` with ``--no-sendfile`` to actually allow
|
||||
disabling.
|
||||
.. versionchanged:: 19.6
|
||||
added support for the ``SENDFILE`` environment variable
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user