mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixed missing Body.Close when doing some HTTP requests. It should improve some request issues.
This commit is contained in:
parent
a8ae398bf5
commit
830c458fe7
2 changed files with 7 additions and 1 deletions
|
@ -64,6 +64,9 @@ func (r *Registry) LookupRemoteImage(imgId, registry string, authConfig *auth.Au
|
||||||
}
|
}
|
||||||
req.SetBasicAuth(authConfig.Username, authConfig.Password)
|
req.SetBasicAuth(authConfig.Username, authConfig.Password)
|
||||||
res, err := rt.RoundTrip(req)
|
res, err := rt.RoundTrip(req)
|
||||||
|
if err == nil {
|
||||||
|
defer res.Body.Close()
|
||||||
|
}
|
||||||
return err == nil && res.StatusCode == 307
|
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, ", "))
|
req.Header.Set("Authorization", "Token "+strings.Join(token, ", "))
|
||||||
res, err := r.client.Do(req)
|
res, err := r.client.Do(req)
|
||||||
defer res.Body.Close()
|
if err == nil {
|
||||||
|
defer res.Body.Close()
|
||||||
|
}
|
||||||
utils.Debugf("Got status code %d from %s", res.StatusCode, endpoint)
|
utils.Debugf("Got status code %d from %s", res.StatusCode, endpoint)
|
||||||
if err != nil || (res.StatusCode != 200 && res.StatusCode != 404) {
|
if err != nil || (res.StatusCode != 200 && res.StatusCode != 404) {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -321,6 +321,7 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgId, endpoin
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer layer.Close()
|
||||||
if err := srv.runtime.graph.Register(utils.ProgressReader(layer, contentLength, out, sf.FormatProgress("Downloading", "%v/%v (%v)"), sf), false, img); err != nil {
|
if err := srv.runtime.graph.Register(utils.ProgressReader(layer, contentLength, out, sf.FormatProgress("Downloading", "%v/%v (%v)"), sf), false, img); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue