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

don't attempt range request without object size #227

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Dec 20, 2019

The range logic was being erroneously applied when there was no
Content-Length returned by the HEAD call. This frequently causes
download requests to report success without downloading anything,
which results in the next process in the stream (the decompressor in
the tar.gz case) to return an EOF error because there is no file content.

Clone the http header when copying them to new requests, so that changes
are not inadvertently reflected in the caller.

The GetFile method still has the unfortunate behavior of not verifying
the destination file for the range request (which it currently can't,
because there is no metadata to compare). This means that a call to
replace an existing file when the server supports byte-range, will
either succeed if the new length is <= the previous, or corrupt the file
by appending new bytes. Silent corruption can be avoided by added a
checksum parameter to the go-getter request, but will still result in
failure to download.

Update the HttpGetter.GetFile method docs to reflect this behavior. In most
cases however the caller is not looking at the HttpGetter itself, as
go-getter is attempting to abstract this away. This means there needs to
be global support in the Client to make this a viable option. How to add
this can be decided separate from this fix.

@jbardin jbardin added the bug label Dec 20, 2019
The range logic was being erroneously applied when there was no
Content-Length returned by the HEAD call.

Clone the http header when copying them to new requests, so that changes
are not inadvertently reflected in the caller.

The GetFile method still has the unfortunate behavior of not verifying
the destination file for the range request (which it currently can't,
because there is no metadata to compare). This means that a call to
replace an existing file when the server supports byte-range, will
either succeed if the new length is <= the previous, or corrupt the file
by appending new bytes. Silent corruption can be avoided by added a
`checksum` parameter to the go-getter request, but will still result in
failure to download.

Update the HttpGetter.GetFile method docs to reflect this behavior. In
most cases however the caller is not looking at the HttpGetter itself,
as go-getter is attempting to abstract this away. This means there needs
to be global support in the Client to make this a viable option. How to
add this can be decided separate from this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants