|
|
@ -91,18 +91,6 @@ func New(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*Ad |
|
|
|
return clnt, nil |
|
|
|
return clnt, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// redirectHeaders copies all headers when following a redirect URL.
|
|
|
|
|
|
|
|
// This won't be needed anymore from go 1.8 (https://github.com/golang/go/issues/4800)
|
|
|
|
|
|
|
|
func redirectHeaders(req *http.Request, via []*http.Request) error { |
|
|
|
|
|
|
|
if len(via) == 0 { |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for key, val := range via[0].Header { |
|
|
|
|
|
|
|
req.Header[key] = val |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func privateNew(endpoint, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error) { |
|
|
|
func privateNew(endpoint, accessKeyID, secretAccessKey string, secure bool) (*AdminClient, error) { |
|
|
|
// construct endpoint.
|
|
|
|
// construct endpoint.
|
|
|
|
endpointURL, err := getEndpointURL(endpoint, secure) |
|
|
|
endpointURL, err := getEndpointURL(endpoint, secure) |
|
|
@ -121,7 +109,6 @@ func privateNew(endpoint, accessKeyID, secretAccessKey string, secure bool) (*Ad |
|
|
|
// Instantiate http client and bucket location cache.
|
|
|
|
// Instantiate http client and bucket location cache.
|
|
|
|
httpClient: &http.Client{ |
|
|
|
httpClient: &http.Client{ |
|
|
|
Transport: http.DefaultTransport, |
|
|
|
Transport: http.DefaultTransport, |
|
|
|
CheckRedirect: redirectHeaders, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|