From 372e905dad248d5cd13eefdf6d99f022c057a97d Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 11 May 2017 18:19:12 +0200 Subject: [PATCH] s3: Enforce virtual host style with China endpoint (#2153) --- cmd/client-s3.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/client-s3.go b/cmd/client-s3.go index e75f2949..279d6516 100644 --- a/cmd/client-s3.go +++ b/cmd/client-s3.go @@ -935,6 +935,10 @@ func isAmazon(host string) bool { return s3utils.IsAmazonEndpoint(url.URL{Host: host}) } +func isAmazonChina(host string) bool { + return s3utils.IsAmazonChinaEndpoint(url.URL{Host: host}) +} + func isAmazonAccelerated(host string) bool { return host == "s3-accelerate.amazonaws.com" } @@ -947,7 +951,7 @@ func isGoogle(host string) bool { // Currently only supported hosts with virtual style // are Amazon S3 and Google Cloud Storage. func isVirtualHostStyle(host string) bool { - return isAmazon(host) || isGoogle(host) || isAmazonAccelerated(host) + return isAmazon(host) && !isAmazonChina(host) || isGoogle(host) || isAmazonAccelerated(host) } // url2BucketAndObject gives bucketName and objectName from URL path.