-
-
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
[StaticRoute] Add preliminary support for sendfile system call. #503
Conversation
@@ -145,7 +145,7 @@ class StaticRoute(Route): | |||
|
|||
def __init__(self, name, prefix, directory, *, | |||
expect_handler=None, chunk_size=256*1024, | |||
response_factory=None): | |||
response_factory=None, sendfile_fallback=False): |
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.
Fallback should be performed automatically.
User doesn't know (and doesn't care) is underlying OS support sendfile.
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.
True, but it's useful to force the use of the fallback sendfile in the tests. That's the primary reason why the option exists.
But fallback is done automatically if sendfile_fallback=False
. This should really be named force_sendfile_fallback
, but that's too long.
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.
Public API is made not for tests, but for users. There is no need to pollute it with special flags, while you may call exact sendfile function in tests.
Yes, all tests should be passed with sendfile and fallback. |
…sendfile` for RANGE support.
[StaticRoute] Add preliminary support for sendfile system call.
Thanks! |
This is a first draft of
sendfile
support. Not merge ready, yet. Please critique.The tests probably need some work. Should we test every static file test with both
sendfile
andsendfile_fallback
?#398