diff --git a/docker/docker_client.go b/docker/docker_client.go index 4e9fe5756f..660a325c5d 100644 --- a/docker/docker_client.go +++ b/docker/docker_client.go @@ -9,6 +9,7 @@ import ( "io/ioutil" "net" "net/http" + "net/http/httputil" "os" "path/filepath" "strings" @@ -248,10 +249,14 @@ func (c *dockerClient) makeRequestToResolvedURL(method, url string, headers map[ } } logrus.Debugf("%s %s", method, url) + dro, _ := httputil.DumpRequestOut(req, false) + logrus.Errorf("===REQ===\n%s\n===REQ===\n", dro) res, err := c.client.Do(req) if err != nil { return nil, err } + dr, _ := httputil.DumpResponse(res, false) + logrus.Errorf("===RES===\n%s\n===RES===\n", dr) return res, nil } @@ -313,10 +318,14 @@ func (c *dockerClient) getBearerToken(realm, service, scope string) (*bearerToke // TODO(runcom): insecure for now to contact the external token service tr.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} client := &http.Client{Transport: tr} + dro, _ := httputil.DumpRequestOut(authReq, false) + logrus.Errorf("===REQ===\n%s\n===REQ===\n", dro) res, err := client.Do(authReq) if err != nil { return nil, err } + dr, _ := httputil.DumpResponse(res, false) + logrus.Errorf("===RES===\n%s\n===RES===\n", dr) defer res.Body.Close() switch res.StatusCode { case http.StatusUnauthorized: diff --git a/docker/docker_image_src.go b/docker/docker_image_src.go index d84c31afcb..9b4c69d45d 100644 --- a/docker/docker_image_src.go +++ b/docker/docker_image_src.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "mime" "net/http" + "net/http/httputil" "net/url" "os" "strconv" @@ -239,11 +240,19 @@ func (s *dockerImageSource) getOneSignature(url *url.URL) (signature []byte, mis return sig, false, nil case "http", "https": + req, err := http.NewRequest("GET", url.String(), nil) + if err != nil { + return nil, false, err + } logrus.Debugf("GET %s", url) - res, err := s.c.client.Get(url.String()) + dro, _ := httputil.DumpRequestOut(req, false) + logrus.Errorf("===REQ===\n%s\n===REQ===\n", dro) + res, err := s.c.client.Do(req) if err != nil { return nil, false, err } + dr, _ := httputil.DumpResponse(res, false) + logrus.Errorf("===RES===\n%s\n===RES===\n", dr) defer res.Body.Close() if res.StatusCode == http.StatusNotFound { return nil, true, nil diff --git a/openshift/openshift.go b/openshift/openshift.go index 9ab905e2bc..d651960553 100644 --- a/openshift/openshift.go +++ b/openshift/openshift.go @@ -8,6 +8,7 @@ import ( "io" "io/ioutil" "net/http" + "net/http/httputil" "net/url" "strings" @@ -95,18 +96,20 @@ func (c *openshiftClient) doRequest(method, path string, requestBody []byte) ([] } logrus.Debugf("%s %s", method, url) + dro, _ := httputil.DumpRequestOut(req, false) + logrus.Errorf("===REQ===\n%s\n===REQ===\n", dro) res, err := c.httpClient.Do(req) if err != nil { return nil, err } + dr, _ := httputil.DumpResponse(res, false) + logrus.Errorf("===RES===\n%s\n===RES===\n", dr) defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err } - logrus.Debugf("Got body: %s", body) - // FIXME: Just throwing this useful information away only to try to guess later... - logrus.Debugf("Got content-type: %s", res.Header.Get("Content-Type")) + // FIXME: Just throwing Content-Type away only to try to guess later... var status status statusValid := false