forked from TrueCloudLab/distribution
Fixed missing Body.Close when doing some HTTP requests. It should improve some request issues.
This commit is contained in:
parent
e742b3efb6
commit
fc340ec966
1 changed files with 6 additions and 1 deletions
|
@ -64,6 +64,9 @@ func (r *Registry) LookupRemoteImage(imgId, registry string, authConfig *auth.Au
|
|||
}
|
||||
req.SetBasicAuth(authConfig.Username, authConfig.Password)
|
||||
res, err := rt.RoundTrip(req)
|
||||
if err == nil {
|
||||
defer res.Body.Close()
|
||||
}
|
||||
return err == nil && res.StatusCode == 307
|
||||
}
|
||||
|
||||
|
@ -152,7 +155,9 @@ func (r *Registry) GetRemoteTags(registries []string, repository string, token [
|
|||
}
|
||||
req.Header.Set("Authorization", "Token "+strings.Join(token, ", "))
|
||||
res, err := r.client.Do(req)
|
||||
if err == nil {
|
||||
defer res.Body.Close()
|
||||
}
|
||||
utils.Debugf("Got status code %d from %s", res.StatusCode, endpoint)
|
||||
if err != nil || (res.StatusCode != 200 && res.StatusCode != 404) {
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue