-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling sendfile w/ env 'AIOHTTP_NOSENDFILE=1' #629
Conversation
Allow disabling sendfile w/ env 'AIOHTTP_NOSENDFILE=1'
Perfect! |
Wouldn't it be better to do this in line 257 of web_urldispatcher.py, where the implementation of sendfile is chosen? |
Maybe you are right. I dont care too much honestly |
I wouldn't be able to Perhaps, the other section should be moved into the constructor as well, so we can mock test that as well and get rid of no coverage pragma. It's fine for now, but it's something to consider in the static route refactoring (issue #468) |
@@ -163,6 +163,9 @@ def __init__(self, name, prefix, directory, *, | |||
raise ValueError( | |||
"No directory exists at '{}'".format(self._directory)) | |||
|
|||
if os.environ.get("AIOHTTP_NOSENDFILE") == "1": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that definition of this environment variable switch is differs from other environment variable switches used in asyncio/aiohttp.
AIOHTTP_NO_EXTENSIONS
is checked in the following way:
if bool(os.environ.get('AIOHTTP_NO_EXTENSIONS')):
At least inside aiohttp
library environment variables switches should work in the same way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was fixed after the merge: 9dc529b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks!
StaticRoute
can now be forced to not usesendfile
system call if environment variableAIOHTTP_NOSENDFILE=1
.See issue #628