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. restarting workers.
""" """
class Sendfile(Setting): class Sendfile(Setting):
name = "sendfile" name = "sendfile"
section = "Server Mechanics" section = "Server Mechanics"
cli = ["--no-sendfile"] cli = ["--no-sendfile"]
validator = validate_bool validator = validate_bool
action = "store_false" action = "store_const"
default = True const = False
desc = """\ desc = """\
Disables the use of ``sendfile()``. Disables the use of ``sendfile()``.
@ -837,6 +838,7 @@ class Sendfile(Setting):
disabling. disabling.
""" """
class Chdir(Setting): class Chdir(Setting):
name = "chdir" name = "chdir"
section = "Server Mechanics" section = "Server Mechanics"

View File

@ -347,7 +347,7 @@ class Response(object):
util.write(self.sock, arg, self.chunked) util.write(self.sock, arg, self.chunked)
def can_sendfile(self): 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): def sendfile(self, respiter):
if self.cfg.is_ssl or not self.can_sendfile(): if self.cfg.is_ssl or not self.can_sendfile():