From 5b728cea45abc2aafbb2ef27b0dc9eb86a87699a Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Fri, 1 Mar 2019 22:45:26 +0200 Subject: [PATCH] Vendor Update --- vendor.conf | 10 ++++----- .../k8s.io/apimachinery/pkg/util/net/http.go | 21 +++++++------------ .../client-go/transport/token_source.go | 4 ++++ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/vendor.conf b/vendor.conf index b8593600..75b9670d 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,7 +1,7 @@ -# package -github.com/rancher/types +# package +github.com/rancher/types -k8s.io/kubernetes 9dd6d355bd39a7b465fb6dd9da1ebd6277f0eac4 https://github.com/rancher/kubernetes.git transitive=true,staging=true -bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git -golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 +k8s.io/kubernetes v1.12.5-rancher-v2-1 https://github.com/rancher/kubernetes.git transitive=true,staging=true +bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git +golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 github.com/rancher/norman 27672c8d7a1fbb0af6eab0d71982843511b404fd diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/http.go b/vendor/k8s.io/apimachinery/pkg/util/net/http.go index 5f966610..7c2a5e62 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/http.go +++ b/vendor/k8s.io/apimachinery/pkg/util/net/http.go @@ -322,7 +322,7 @@ type Dialer interface { // ConnectWithRedirects uses dialer to send req, following up to 10 redirects (relative to // originalLocation). It returns the opened net.Conn and the raw response bytes. // If requireSameHostRedirects is true, only redirects to the same host are permitted. -func ConnectWithRedirects(processRedirect bool, originalMethod string, originalLocation *url.URL, header http.Header, originalBody io.Reader, dialer Dialer, requireSameHostRedirects bool) (net.Conn, []byte, int, error) { +func ConnectWithRedirects(originalMethod string, originalLocation *url.URL, header http.Header, originalBody io.Reader, dialer Dialer, requireSameHostRedirects bool) (net.Conn, []byte, error) { const ( maxRedirects = 9 // Fail on the 10th redirect maxResponseSize = 16384 // play it safe to allow the potential for lots of / large headers @@ -334,7 +334,6 @@ func ConnectWithRedirects(processRedirect bool, originalMethod string, originalL intermediateConn net.Conn rawResponse = bytes.NewBuffer(make([]byte, 0, 256)) body = originalBody - respCode int ) defer func() { @@ -346,19 +345,19 @@ func ConnectWithRedirects(processRedirect bool, originalMethod string, originalL redirectLoop: for redirects := 0; ; redirects++ { if redirects > maxRedirects { - return nil, nil, 0, fmt.Errorf("too many redirects (%d)", redirects) + return nil, nil, fmt.Errorf("too many redirects (%d)", redirects) } req, err := http.NewRequest(method, location.String(), body) if err != nil { - return nil, nil, 0, err + return nil, nil, err } req.Header = header intermediateConn, err = dialer.Dial(req) if err != nil { - return nil, nil, 0, err + return nil, nil, err } // Peek at the backend response. @@ -373,12 +372,6 @@ redirectLoop: break redirectLoop } - respCode = resp.StatusCode - - if !processRedirect { - break redirectLoop - } - switch resp.StatusCode { case http.StatusFound: // Redirect, continue. @@ -398,7 +391,7 @@ redirectLoop: // Prepare to follow the redirect. redirectStr := resp.Header.Get("Location") if redirectStr == "" { - return nil, nil, 0, fmt.Errorf("%d response missing Location header", resp.StatusCode) + return nil, nil, fmt.Errorf("%d response missing Location header", resp.StatusCode) } // We have to parse relative to the current location, NOT originalLocation. For example, // if we request http://foo.com/a and get back "http://bar.com/b", the result should be @@ -406,7 +399,7 @@ redirectLoop: // should be http://bar.com/c, not http://foo.com/c. location, err = location.Parse(redirectStr) if err != nil { - return nil, nil, 0, fmt.Errorf("malformed Location header: %v", err) + return nil, nil, fmt.Errorf("malformed Location header: %v", err) } // Only follow redirects to the same host. Otherwise, propagate the redirect response back. @@ -421,7 +414,7 @@ redirectLoop: connToReturn := intermediateConn intermediateConn = nil // Don't close the connection when we return it. - return connToReturn, rawResponse.Bytes(), respCode, nil + return connToReturn, rawResponse.Bytes(), nil } // CloneRequest creates a shallow copy of the request along with a deep copy of the Headers. diff --git a/vendor/k8s.io/client-go/transport/token_source.go b/vendor/k8s.io/client-go/transport/token_source.go index c9bdf9a9..a1c7f066 100644 --- a/vendor/k8s.io/client-go/transport/token_source.go +++ b/vendor/k8s.io/client-go/transport/token_source.go @@ -64,6 +64,10 @@ type tokenSourceTransport struct { ort http.RoundTripper } +func (tst *tokenSourceTransport) WrappedRoundTripper() http.RoundTripper { + return tst.base +} + func (tst *tokenSourceTransport) RoundTrip(req *http.Request) (*http.Response, error) { // This is to allow --token to override other bearer token providers. if req.Header.Get("Authorization") != "" {