diff --git a/vendor/github.com/minio/minio-go/api-get-object-file.go b/vendor/github.com/minio/minio-go/api-get-object-file.go index 058e9a982..477a0969f 100644 --- a/vendor/github.com/minio/minio-go/api-get-object-file.go +++ b/vendor/github.com/minio/minio-go/api-get-object-file.go @@ -81,7 +81,9 @@ func (c Client) FGetObject(bucketName, objectName, filePath string) error { // Initialize get object request headers to set the // appropriate range offsets to read from. reqHeaders := NewGetReqHeaders() - reqHeaders.SetRange(st.Size(), 0) + if st.Size() > 0 { + reqHeaders.SetRange(st.Size(), 0) + } // Seek to current position for incoming reader. objectReader, objectStat, err := c.getObject(bucketName, objectName, reqHeaders) diff --git a/vendor/github.com/minio/minio-go/api-get-object.go b/vendor/github.com/minio/minio-go/api-get-object.go index f530d05ed..2abd4608e 100644 --- a/vendor/github.com/minio/minio-go/api-get-object.go +++ b/vendor/github.com/minio/minio-go/api-get-object.go @@ -111,7 +111,10 @@ func (c Client) GetObject(bucketName, objectName string) (*Object, error) { reqHeaders.SetRange(req.Offset, req.Offset+int64(len(req.Buffer))-1) httpReader, objectInfo, err = c.getObject(bucketName, objectName, reqHeaders) } else { - reqHeaders.SetRange(req.Offset, 0) + if req.Offset > 0 { + reqHeaders.SetRange(req.Offset, 0) + } + // First request is a Read request. httpReader, objectInfo, err = c.getObject(bucketName, objectName, reqHeaders) } @@ -194,7 +197,10 @@ func (c Client) GetObject(bucketName, objectName string) (*Object, error) { httpReader, _, err = c.getObject(bucketName, objectName, reqHeaders) } else { // Range is set with respect to the offset. - reqHeaders.SetRange(req.Offset, 0) + if req.Offset > 0 { + reqHeaders.SetRange(req.Offset, 0) + } + httpReader, objectInfo, err = c.getObject(bucketName, objectName, reqHeaders) } if err != nil { diff --git a/vendor/github.com/minio/minio-go/my-testfile b/vendor/github.com/minio/minio-go/my-testfile deleted file mode 100644 index 6c5d4031e..000000000 Binary files a/vendor/github.com/minio/minio-go/my-testfile and /dev/null differ diff --git a/vendor/github.com/minio/minio-go/request-headers.go b/vendor/github.com/minio/minio-go/request-headers.go index 31b521fea..fa23b2fe3 100644 --- a/vendor/github.com/minio/minio-go/request-headers.go +++ b/vendor/github.com/minio/minio-go/request-headers.go @@ -1,5 +1,5 @@ /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016-17 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,23 +83,29 @@ func (c RequestHeaders) SetModified(modTime time.Time) error { // See https://tools.ietf.org/html/rfc7233#section-3.1 for reference. func (c RequestHeaders) SetRange(start, end int64) error { switch { - case start <= 0 && end < 0: - // Read everything until the 'end'. `bytes=-N` + case start == 0 && end < 0: + // Read last '-end' bytes. `bytes=-N`. c.Set("Range", fmt.Sprintf("bytes=%d", end)) - case start > 0 && end == 0: - // Read everything starting from offset 'start'. `bytes=N-` + case 0 < start && end == 0: + // Read everything starting from offset + // 'start'. `bytes=N-`. c.Set("Range", fmt.Sprintf("bytes=%d-", start)) - case start > 0 && end > 0 && end >= start: - // Read everything starting at 'start' till the 'end'. `bytes=N-M` + case 0 <= start && start <= end: + // Read everything starting at 'start' till the + // 'end'. `bytes=N-M` c.Set("Range", fmt.Sprintf("bytes=%d-%d", start, end)) - case start == 0 && end == 0: - // Client attempting to read the whole file. - return nil + default: + // All other cases such as + // bytes=-3- + // bytes=5-3 + // bytes=-2-4 + // bytes=-3-0 + // bytes=-3--2 + // are invalid. + return ErrInvalidArgument( + fmt.Sprintf( + "Invalid range specified: start=%d end=%d", + start, end)) } - // All other cases such as - // bytes=-N- - // bytes=N-M where M < N - // These return error and are not supported. - return ErrInvalidArgument(fmt.Sprintf("Invalid range start and end specified bytes=%d-%d", - start, end)) + return nil } diff --git a/vendor/vendor.json b/vendor/vendor.json index 5c2bd2f50..4d941d156 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -216,10 +216,10 @@ "revisionTime": "2016-02-29T08:42:30-08:00" }, { - "checksumSHA1": "E0n14tprPsyG3s4MXxZmLrcaNm4=", + "checksumSHA1": "pvBoasrJ8jrJJG0JNJvxyCZighw=", "path": "github.com/minio/minio-go", - "revision": "fe31943bd4638093653a6a584dc1c6c6487e06c9", - "revisionTime": "2017-05-02T08:16:08Z" + "revision": "75a218a15d5413c9a961318160f4c12a29bf9147", + "revisionTime": "2017-05-04T18:42:21Z" }, { "checksumSHA1": "lsxCcRcNUDxhQyO999SOdvKzzfM=",