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
This commit is contained in:
Randall Leeds 2015-12-23 16:04:35 -08:00
parent 2ac41c406b
commit d8b6f0afff
2 changed files with 5 additions and 3 deletions

View File

@ -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"

View File

@ -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():