Support HTTP range requests #18
Labels
No labels
Kind/Bug
Kind/Enhancement
Kind/Feature
Project/Lander
Project/Landerctl
idea
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Chewing_Bever/lander#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For hosted files, HTTP range requests would be useful as they allow users to resume a download. I do think this will require some refactoring of the HTTP library though, so this might be a bit of a challenge to implement.
I just had a thought on how this could be implemented.
The concept of response steps was introduced to allow custom code to write the response body, e.g. streaming the data from a store entry. However, this might be the wrong way to solve this.
Instead, we could introduce a "data reader" function that can be configured for each route. The signature of this function would include a buffer to write to, an index inside the response body from which to read, and how many bytes to read from that position. The abstraction could then track how many bytes of the body have been written and stop when needed.
Using this abstraction, HTTP range requests could be implemented by simply using this function multiple times for each part of the response. Writing the intermediate headers can be done inside the HTTP loop, with no user interaction required.
This will probably require #33 first, as the response step that writes the headers conflicts with the idea to remove response steps alltogether.