fix: properly handle io.copy errors
What does this MR do?
Improved version of !676 (merged)
See !681 (merged)
This is due to go wrapping the response body in a cancelTimerBody
if the deadline is not zero (https://github.com/golang/go/blob/4fea5935f5f03b5037c792f8d5f5aa4cba90f1d6/src/net/http/client.go#L287-L293), which will return a timeout error if the request timed out (https://github.com/golang/go/blob/4fea5935f5f03b5037c792f8d5f5aa4cba90f1d6/src/net/http/client.go#L971-L976).
It also guard against context errors: a read could trigger an http request (see https://gitlab.com/gitlab-org/gitlab-pages/-/blob/master/internal/httprange/http_reader.go#L59) and since we're using the vfs client which has some timeouts we could get a ctx error.
Closes #698 (closed)
TODO
-
I added the Changelog
trailer (e.g.Changelog: added
) to the commits that need to be included in the changelog -
I added unit tests or they are not required -
I added acceptance tests or they are not required -
I added documentation (or it's not required) -
I followed code review guidelines -
I followed Go Style guidelines
Edited by feistel