-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
allow range request for every content type, move lock only when metad… #495
Conversation
…ata has to be updated
related to #409 see #490 (comment) and #490 (comment) @stefanbenten can you take a look when you have time? this is to add the support on |
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.
This needs a lot more work to do proper range requests without having to download the entire file. I have been trying to plumb the range requests through to the backend and let it handle it accordingly. Tho this either requires a change of the backend storage interface or creating lots logic and temporary files from within the storage provider (google storage being the only one tho).
@@ -1051,7 +1065,7 @@ func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) { | |||
reader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader)) | |||
} | |||
|
|||
if w.Header().Get("Range") != "" || strings.HasPrefix(metadata.ContentType, "video") || strings.HasPrefix(metadata.ContentType, "audio") { | |||
if r.Header.Get("Range") != "" { |
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.
This creates a very big amount of unnecessary downloads of the entire file and thus lots of load on the backend storage (for cases of remote storage via full downloads and for local storage due to copying the file entirely into a temp file) in L1078.
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.
it just creates them for every type of file content instead of video and audio files
where was a bug (w
vs r
) in the original implementation that prevented range requests to be fulfilled on non audio/video files
but yes, we should try to exploit range donwload directly from the storage implementation.
we can change the storage.Get
interface to receive the range to pass down to the concrete storage "sdk" in order to minimise what's actually downloaded
good catch anyway: mine was a quick hack and I didn't think about the performance implications
Let me see, if i can push this PR sometime today.. |
closed in favor of #527 we still should keep https://github.com/dutchcoders/transfer.sh/pull/495/files#diff-961509ed3ff668f3172148150903514fb3394d6ff090d6db78d986875b13689fR705-R706, for donwloaders that send multiple concurrent range request |
…ata has to be updated