From d8b6f0afff4805f2f8d631d7b5332cdb19bed0de Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Wed, 23 Dec 2015 16:04:35 -0800 Subject: [PATCH] Clarify --no-sendfile default The --no-sendfile option had a confusing entry in the usage message. Even though sendfile is enabled by default, the --no-sendfile flag showed a true value as the default, which could be interpreted to mean that by default sendfile support is disabled. This change makes the default "None", meaning sendfile is not disabled, which is hopefully slightly more clear. Close #1156 --- gunicorn/config.py | 6 ++++-- gunicorn/http/wsgi.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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():