File delivery range support#7319
Open
pzl wants to merge 7 commits into
Open
Conversation
Member
Author
|
@elastic/elastic-agent-control-plane sorry for the short turnaround, could this be looked over before FF? It is additional behavior only: when serving files through the file delivery route, if a |
cmacknz
reviewed
Jul 6, 2026
| return r.ReplaceAllString(strings.ToLower(strings.TrimSpace(s)), "") | ||
| } | ||
|
|
||
| func (ft *FileDeliveryT) sendFileAsRanges(zlog zerolog.Logger, w http.ResponseWriter, r *http.Request, fileID string, info file.MetaDoc, chunks []file.ChunkInfo, ranges []httpRange) error { |
Member
There was a problem hiding this comment.
You don't set X-File-SHA2 on this path, should you?
Member
Author
There was a problem hiding this comment.
ambiguous when sending byte ranges (would it apply to the range or still the hash of the whole file?) so it wasn't used for range requests. It could be, it would just have to be an explicit call if it were needed
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.
What is the problem this PR solves?
Enables clients (e.g. endpoint) to gracefully resume downloads of (large) files via the HTTP Range header.
This allows for completing large file transfers under unstable or periodic network conditions, as opposed to starting the file download over.
N.B.:
bytes=100-400) and not multipart range requests (e.g.bytes=0-500, 1024-2048, -600).416 Range Unsatisfiableerror ORHTTP 200with full file contents are both acceptable responses. This implementation mostly generates 416s for clients to handle malformed byte strings, but in narrow cases where intent is unclear (e.g. the header is present without a value:Range:) then we do fall back to HTTP 200 with file contents, as spec defines.How does this PR solve the problem?
Only fetch chunks that fall inside the requested range
Design Checklist
Checklist
./changelog/fragmentsusing the changelog toolRelated issues