From 9dc529b3faabec80698d6de138c40c4ec90c1dee Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 10 Nov 2015 10:24:29 +0800 Subject: [PATCH] Change AIOHTTP_NOSENDFILE usage to be consistent with other aiohttp envs --- CHANGES.txt | 2 ++ aiohttp/web_urldispatcher.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index e5ce95b73fe..25853755a09 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,3 +38,5 @@ CHANGES - Enable passing pre-compressed data in requests #621 - Expose named routes via UrlDispatcher.named_routes() #622 + +- Allow disabling sendfile by environment variable AIOHTTP_NOSENDFILE #629 diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py index 17ce659eb22..6627b82cd4f 100644 --- a/aiohttp/web_urldispatcher.py +++ b/aiohttp/web_urldispatcher.py @@ -163,7 +163,7 @@ def __init__(self, name, prefix, directory, *, raise ValueError( "No directory exists at '{}'".format(self._directory)) - if os.environ.get("AIOHTTP_NOSENDFILE") == "1": + if bool(os.environ.get("AIOHTTP_NOSENDFILE")): self._sendfile = self._sendfile_fallback def match(self, path):