diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-02-02 09:32:00 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-02-02 09:32:00 -0500 |
commit | 701d1ab638b23c24877fc41824add66232446676 (patch) | |
tree | ec120c88d38ac9d38d9eabdd3270b52bb6ac9d96 /vendor/github.com/minio/minio-go/bucket-cache.go | |
parent | ca3211bc04f6dea34e8168217182637d1419f998 (diff) | |
download | chat-701d1ab638b23c24877fc41824add66232446676.tar.gz chat-701d1ab638b23c24877fc41824add66232446676.tar.bz2 chat-701d1ab638b23c24877fc41824add66232446676.zip |
Updating server dependancies (#5249)
Diffstat (limited to 'vendor/github.com/minio/minio-go/bucket-cache.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/bucket-cache.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/vendor/github.com/minio/minio-go/bucket-cache.go b/vendor/github.com/minio/minio-go/bucket-cache.go index 4ad106959..46dfe9348 100644 --- a/vendor/github.com/minio/minio-go/bucket-cache.go +++ b/vendor/github.com/minio/minio-go/bucket-cache.go @@ -23,6 +23,9 @@ import ( "path" "strings" "sync" + + "github.com/minio/minio-go/pkg/s3signer" + "github.com/minio/minio-go/pkg/s3utils" ) // bucketLocationCache - Provides simple mechanism to hold bucket @@ -85,7 +88,7 @@ func (c Client) getBucketLocation(bucketName string) (string, error) { return location, nil } - if isAmazonChinaEndpoint(c.endpointURL) { + if s3utils.IsAmazonChinaEndpoint(c.endpointURL) { // For china specifically we need to set everything to // cn-north-1 for now, there is no easier way until AWS S3 // provides a cleaner compatible API across "us-east-1" and @@ -160,10 +163,14 @@ func (c Client) getBucketLocationRequest(bucketName string) (*http.Request, erro urlValues.Set("location", "") // Set get bucket location always as path style. - targetURL, err := url.Parse(c.endpointURL) - if err != nil { - return nil, err + targetURL := c.endpointURL + + // Requesting a bucket location from an accelerate endpoint returns a 400, + // so default to us-east-1 for the lookup + if s3utils.IsAmazonS3AccelerateEndpoint(c.endpointURL) { + targetURL.Host = getS3Endpoint("us-east-1") } + targetURL.Path = path.Join(bucketName, "") + "/" targetURL.RawQuery = urlValues.Encode() @@ -189,9 +196,9 @@ func (c Client) getBucketLocationRequest(bucketName string) (*http.Request, erro // Sign the request. if c.signature.isV4() { - req = signV4(*req, c.accessKeyID, c.secretAccessKey, "us-east-1") + req = s3signer.SignV4(*req, c.accessKeyID, c.secretAccessKey, "us-east-1") } else if c.signature.isV2() { - req = signV2(*req, c.accessKeyID, c.secretAccessKey) + req = s3signer.SignV2(*req, c.accessKeyID, c.secretAccessKey) } return req, nil } |