diff --git a/gunicorn/config.py b/gunicorn/config.py index de1f7b0f..ab6b276f 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -821,13 +821,14 @@ class PreloadApp(Setting): restarting workers. """ + class Sendfile(Setting): name = "sendfile" section = "Server Mechanics" cli = ["--no-sendfile"] validator = validate_bool - action = "store_false" - default = True + action = "store_const" + const = False desc = """\ Disables the use of ``sendfile()``. @@ -837,6 +838,7 @@ class Sendfile(Setting): disabling. """ + class Chdir(Setting): name = "chdir" section = "Server Mechanics" diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index f76d722d..c537166e 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -347,7 +347,7 @@ class Response(object): util.write(self.sock, arg, self.chunked) def can_sendfile(self): - return self.cfg.sendfile and sendfile is not None + return self.cfg.sendfile is not False and sendfile is not None def sendfile(self, respiter): if self.cfg.is_ssl or not self.can_sendfile():