-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
feat(static): set Content-Length
for static file responses
#1991
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1991 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 6669 6674 +5
Branches 1079 1079
=========================================
+ Hits 6669 6674 +5
Continue to review full report at Codecov.
|
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.
looks ok. Just a test issue that I think would make sense changing before merging
Also don't we also miss the asgi tests?
We already have unit tests covering ASGI too, but I will check if all the functionality is verified in unit tests as well. Otherwise, ASGI has no concept of |
# Ignore Range headers for zero-byte files; just serve the empty body | ||
# since Content-Range can't be used to express a zero-byte body | ||
return fh, None | ||
# NOTE(tipabu): Ignore Range headers for zero-byte files; just serve |
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.
For reference: @tipabu I prefixed your comments with your GH nick, and refactored the code slightly to work around issues with buggy sendfile
implementations in many popular WSGI servers such as Gunicorn, uWSGI, etc.
Also fix range request support across different WSGI servers by always providing a Python wrapper without a file descriptor, since many
sendfile
implementations are buggy wrt not respecting the current file offset; both Gunicorn (benoitc/gunicorn#2669) and uWSGI are affected according to my testing.There is still an open question remaining what to do with Meinheld: I've filed this as a separate issue (#1992).