From f20b5e1323a6da49b060ccb18af12899296706e6 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 6 May 2013 15:58:04 -0700 Subject: [PATCH] Fix issue when login in with a different user and trying to push --- commands.go | 2 ++ registry.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index cdc948e785..8895712a24 100644 --- a/commands.go +++ b/commands.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/dotcloud/docker/auth" "github.com/dotcloud/docker/rcli" + "github.com/shin-/cookiejar" "io" "log" "net/http" @@ -154,6 +155,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout rcli.DockerConn, args .. if err != nil { fmt.Fprintf(stdout, "Error: %s\r\n", err) } else { + srv.runtime.graph.getHttpClient().Jar = cookiejar.NewCookieJar() srv.runtime.authConfig = newAuthConfig } if status != "" { diff --git a/registry.go b/registry.go index 1028d72725..f9bc756643 100644 --- a/registry.go +++ b/registry.go @@ -69,7 +69,7 @@ func (graph *Graph) getRemoteHistory(imgId, registry string, token []string) ([] func (graph *Graph) getHttpClient() *http.Client { if graph.httpClient == nil { - graph.httpClient = new(http.Client) + graph.httpClient = &http.Client{} graph.httpClient.Jar = cookiejar.NewCookieJar() } return graph.httpClient