Skip to content

Commit

Permalink
Vendorize new changes from minio-go (#2246)
Browse files Browse the repository at this point in the history
This PR brings in changes for

- PutObjectStream with no content-length is heavily
  optimized so `mc pipe` will not run out of memory
  for large uploads.
- Fixes a bug in Signature v2 for HTTP requests.
- Support us-gov-west-1 region as well.
- Auto region handling is inside minio-go now.
  • Loading branch information
harshavardhana authored and deekoder committed Sep 3, 2017
1 parent 3f4d3ee commit fe58346
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 152 deletions.
22 changes: 1 addition & 21 deletions cmd/client-s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"net/url"
"os"
"path"
"regexp"
"strings"
"sync"
"time"
Expand All @@ -46,7 +45,6 @@ type s3Client struct {
targetURL *clientURL
api *minio.Client
virtualStyle bool
region string
}

const (
Expand Down Expand Up @@ -111,10 +109,9 @@ func newFactory() func(config *Config) (Client, *probe.Error) {
if strings.ToUpper(config.Signature) == "S3V2" {
creds = credentials.NewStaticV2(config.AccessKey, config.SecretKey, "")
}
s3Clnt.region = getRegionFromHost(hostName)
// Not found. Instantiate a new minio
var e error
api, e = minio.NewWithCredentials(hostName, creds, useTLS, s3Clnt.region)
api, e = minio.NewWithCredentials(hostName, creds, useTLS, "")
if e != nil {
return nil, probe.NewError(e)
}
Expand Down Expand Up @@ -722,9 +719,6 @@ func (c *s3Client) MakeBucket(region string, ignoreExisting bool) *probe.Error {
if object != "" {
return probe.NewError(BucketNameTopLevel{})
}
if c.region != "" {
region = c.region
}
e := c.api.MakeBucket(bucket, region)
if e != nil {
// Ignore bucket already existing error when ignoreExisting flag is enabled
Expand Down Expand Up @@ -929,20 +923,6 @@ func isVirtualHostStyle(host string) bool {
return isAmazon(host) && !isAmazonChina(host) || isGoogle(host) || isAmazonAccelerated(host)
}

// getRegionFromHost - parse region from host name if present.
func getRegionFromHost(host string) (region string) {
region = ""
if s3utils.IsGoogleEndpoint(url.URL{Host: host}) || s3utils.IsAmazonGovCloudEndpoint(url.URL{Host: host}) || s3utils.IsAmazonChinaEndpoint(url.URL{Host: host}) {
return
}
re := regexp.MustCompile("s3[.-]?(.*?)\\.amazonaws\\.com$")
parts := re.FindStringSubmatch(host)
if len(parts) > 1 {
region = parts[1]
}
return
}

// url2BucketAndObject gives bucketName and objectName from URL path.
func (c *s3Client) url2BucketAndObject() (bucketName, objectName string) {
path := c.targetURL.Path
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/minio/minio-go/api-compose-object.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions vendor/github.com/minio/minio-go/api-presigned.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions vendor/github.com/minio/minio-go/api-put-object-common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 24 additions & 28 deletions vendor/github.com/minio/minio-go/api-put-object-multipart.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/minio/minio-go/api-put-object-streaming.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe58346

Please sign in to comment.