From 1dea194699ed94db2eee6d05b30067c2f9ba552f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 5 Feb 2016 18:54:47 -0800 Subject: [PATCH] minio-go: Vendorize with new changes. --- pkg/client/s3/s3.go | 29 ++++++++++--------- .../github.com/minio/minio-go/CONTRIBUTING.md | 2 +- .../minio/minio-go/api-put-object-common.go | 2 +- vendor/github.com/minio/minio-go/api.go | 6 ++++ vendor/vendor.json | 4 +-- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/pkg/client/s3/s3.go b/pkg/client/s3/s3.go index c7199417..38151a60 100644 --- a/pkg/client/s3/s3.go +++ b/pkg/client/s3/s3.go @@ -51,15 +51,6 @@ func newFactory() func(config *client.Config) (client.Client, *probe.Error) { return func(config *client.Config) (client.Client, *probe.Error) { // Creates a parsed URL. targetURL := client.NewURL(config.HostURL) - transport := http.DefaultTransport - if config.Debug == true { - if config.Signature == "S3v4" { - transport = httptracer.GetNewTraceTransport(NewTraceV4(), http.DefaultTransport) - } - if config.Signature == "S3v2" { - transport = httptracer.GetNewTraceTransport(NewTraceV2(), http.DefaultTransport) - } - } // By default enable HTTPs. inSecure := false if targetURL.Scheme == "http" { @@ -116,8 +107,18 @@ func newFactory() func(config *client.Config) (client.Client, *probe.Error) { } // Set app info. api.SetAppInfo(config.AppName, config.AppVersion) - // Set custom transport. - api.SetCustomTransport(transport) + + if config.Debug { + transport := http.DefaultTransport + if config.Signature == "S3v4" { + transport = httptracer.GetNewTraceTransport(NewTraceV4(), http.DefaultTransport) + } + if config.Signature == "S3v2" { + transport = httptracer.GetNewTraceTransport(NewTraceV2(), http.DefaultTransport) + } + // Set custom transport. + api.SetCustomTransport(transport) + } // Store the new api object. s3Clnt.api = api @@ -283,10 +284,10 @@ func (c *s3Client) Stat() (*client.Content, *probe.Error) { switch { // valid case for 'ls -r s3/' case bucket == "" && object == "": - _, err := c.api.ListBuckets() - if err != nil { + _, e := c.api.ListBuckets() + if e != nil { c.mutex.Unlock() - return nil, probe.NewError(err) + return nil, probe.NewError(e) } c.mutex.Unlock() return &client.Content{URL: *c.targetURL, Type: os.ModeDir}, nil diff --git a/vendor/github.com/minio/minio-go/CONTRIBUTING.md b/vendor/github.com/minio/minio-go/CONTRIBUTING.md index b4b224ee..3a938e85 100644 --- a/vendor/github.com/minio/minio-go/CONTRIBUTING.md +++ b/vendor/github.com/minio/minio-go/CONTRIBUTING.md @@ -14,7 +14,7 @@ - Have test cases for the new code. If you have questions about how to do it, please ask in your pull request. - Run `go fmt` - Squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request. - - Make sure `go test -race ./...` and `go build` completes. + - Make sure `go test -short -race ./...` and `go build` completes. * Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project - `minio-go` project is strictly conformant with Golang style diff --git a/vendor/github.com/minio/minio-go/api-put-object-common.go b/vendor/github.com/minio/minio-go/api-put-object-common.go index 1584497b..7c73b24c 100644 --- a/vendor/github.com/minio/minio-go/api-put-object-common.go +++ b/vendor/github.com/minio/minio-go/api-put-object-common.go @@ -55,7 +55,7 @@ func shouldUploadPart(objPart objectPart, objectParts map[int]objectPart) bool { return true } // if md5sum mismatches should upload the part. - if objPart.ETag == uploadedPart.ETag { + if objPart.ETag != uploadedPart.ETag { return true } return false diff --git a/vendor/github.com/minio/minio-go/api.go b/vendor/github.com/minio/minio-go/api.go index f4d2f52f..d11d4478 100644 --- a/vendor/github.com/minio/minio-go/api.go +++ b/vendor/github.com/minio/minio-go/api.go @@ -325,6 +325,12 @@ func (c Client) do(req *http.Request) (*http.Response, error) { // execute the request. resp, err := c.httpClient.Do(req) if err != nil { + // Handle this specifically for now until future Golang + // versions fix this issue properly. + urlErr, ok := err.(*url.Error) + if ok && strings.Contains(urlErr.Err.Error(), "EOF") { + return nil, fmt.Errorf("Connection closed by foreign host %s. Retry again.", urlErr.URL) + } return resp, err } // If trace is enabled, dump http request and response. diff --git a/vendor/vendor.json b/vendor/vendor.json index f0b93ab1..b5d65ee9 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -29,8 +29,8 @@ }, { "path": "github.com/minio/minio-go", - "revision": "c5884ce9ce3ac73b025d0bc58c4d3d72870edc0b", - "revisionTime": "2016-02-02T13:13:10+05:30" + "revision": "e5a223f907d6bf6e6220c716db08fc12285fbb26", + "revisionTime": "2016-02-06T12:33:47+05:30" }, { "path": "github.com/minio/minio-xl/pkg/atomic",