Support HTTP range requests #18
Labels
No Label
Kind/Bug
Kind/Enhancement
Kind/Feature
Project/Lander
Project/Landerctl
idea
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Chewing_Bever/lander#18
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. 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.