Skip to content

fix: properly handle io.copy errors

feistel requested to merge feistel/gitlab-pages:fix/timeout-err into master

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

Edited by feistel

Merge request reports