1
0
mirror of https://github.com/rancher/types.git synced 2025-08-31 12:48:45 +00:00

Vendor Update

This commit is contained in:
galal-hussein
2019-03-01 22:45:26 +02:00
committed by Alena Prokharchyk
parent a4ba8342e2
commit 5b728cea45
3 changed files with 16 additions and 19 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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") != "" {