Repository navigation
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3461 +/- ##
==========================================
- Coverage 95.58% 95.36% -0.22%
==========================================
Files 155 155
Lines 9357 9524 +167
Branches 2746 2776 +30
==========================================
+ Hits 8944 9083 +139
- Misses 413 441 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
exoego
marked this pull request as ready for review
October 1, 2024 02:54
exoego
commented
Oct 1, 2024
Contributor
Author
There was a problem hiding this comment.
Note) ? is added because when serve-static checks Range header, headers is undefined on some existing test cases.
Member
|
Hi @exoego I'm sorry I can't review it yet. Still a little bit busy; please wait. |
Member
|
I'm sorry for being super late. I have an idea, and I'll share it with you soon. |
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3324
This implements 206 Partial Content(also called as range requests) support in
serve-staticmiddleware.It will be useful specially for seeking a video file.
serve-staticbase implementation now accepts an optional function:If
partialContentSupportis provided and HTTP header includes validRange,serve-staticreturns subsets of content.getPartialContentfunction encapsulates a file handle to avoid opening and closing file multiple times.closefunction is invoked when all ranges are read, to teardown the file handle.416 Range Not Satisfiable
The implementation also returns 416 Range Not Satisfiable if
Rangeheaders contains many range requests (more than 10), that is potentially DoS (Denial of Service) attack.This limitation (
10) is just a clueless number.The number may be changed when we understand it is too small/too big.
Not included
If-Range,ETagand so on. I think this feature is useful without having cache-control, which needs a lot work.serverStaticimplementation 😭 It is solely implemented here: https://github.com/honojs/node-server/blob/74e86a28f375e5acd52e342519ff2b1110a95c16/src/serve-static.ts#L59The author should do the following, if applicable
bun run format:fix && bun run lint:fixto format the code