sylabs / scs-library-client

Go client for the Singularity Container Services (SCS) Container Library Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authorization header not set for multi-part download

EmmEff opened this issue · comments

httpGetRangeRequest() uses a generic HTTP client which does include a Authorization header:

func httpGetRangeRequest(ctx context.Context, url string, start, end int64) (*http.Response, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
}
req.Header.Add("Range", fmt.Sprintf("bytes=%d-%d", start, end))
return http.DefaultClient.Do(req)

This causes a 401 Unauthorized error when attempting to access private projects (which require authorization) in Sylabs Cloud Library.