Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

aspacca
Copy link
Collaborator

@aspacca aspacca commented Jul 10, 2022

…ata has to be updated

@aspacca aspacca self-assigned this Jul 10, 2022
@aspacca
Copy link
Collaborator Author

aspacca commented Jul 10, 2022

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 transfer.sh service, hosted instances like https://transfer.sh might require tuninque eventual proxy on top of the service

Copy link
Collaborator

@stefanbenten stefanbenten left a 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") != "" {
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

@stefanbenten
Copy link
Collaborator

Let me see, if i can push this PR sometime today..

@aspacca
Copy link
Collaborator Author

aspacca commented Mar 1, 2023

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

@aspacca aspacca closed this Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants