mirror of https://github.com/docker/docs.git
refresh before closing the connection
Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
parent
ada8208157
commit
014947daad
|
@ -545,12 +545,14 @@ func proxyContainerAndForceRefresh(c *context, w http.ResponseWriter, r *http.Re
|
||||||
r.URL.Path = strings.Replace(r.URL.Path, name, container.Id, 1)
|
r.URL.Path = strings.Replace(r.URL.Path, name, container.Id, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := proxy(c.tlsConfig, container.Engine.Addr, w, r); err != nil {
|
cb := func(resp *http.Response) {
|
||||||
httpError(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
}
|
|
||||||
|
|
||||||
// force fresh container
|
// force fresh container
|
||||||
container.Refresh()
|
container.Refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := proxyAsync(c.tlsConfig, container.Engine.Addr, w, r, cb); err != nil {
|
||||||
|
httpError(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proxy a request to the right node
|
// Proxy a request to the right node
|
||||||
|
|
|
@ -81,14 +81,14 @@ func proxyAsync(tlsConfig *tls.Config, addr string, w http.ResponseWriter, r *ht
|
||||||
w.WriteHeader(resp.StatusCode)
|
w.WriteHeader(resp.StatusCode)
|
||||||
io.Copy(NewWriteFlusher(w), resp.Body)
|
io.Copy(NewWriteFlusher(w), resp.Body)
|
||||||
|
|
||||||
// cleanup
|
|
||||||
resp.Body.Close()
|
|
||||||
closeIdleConnections(client)
|
|
||||||
|
|
||||||
if callback != nil {
|
if callback != nil {
|
||||||
callback(resp)
|
callback(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cleanup
|
||||||
|
resp.Body.Close()
|
||||||
|
closeIdleConnections(client)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue