mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
parent
972a527b66
commit
a02575ebf9
4
vendor/github.com/minio/minio-go/api-get-object-file.go
generated
vendored
4
vendor/github.com/minio/minio-go/api-get-object-file.go
generated
vendored
@ -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)
|
||||
|
10
vendor/github.com/minio/minio-go/api-get-object.go
generated
vendored
10
vendor/github.com/minio/minio-go/api-get-object.go
generated
vendored
@ -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 {
|
||||
|
BIN
vendor/github.com/minio/minio-go/my-testfile
generated
vendored
BIN
vendor/github.com/minio/minio-go/my-testfile
generated
vendored
Binary file not shown.
38
vendor/github.com/minio/minio-go/request-headers.go
generated
vendored
38
vendor/github.com/minio/minio-go/request-headers.go
generated
vendored
@ -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
|
||||
}
|
||||
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -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=",
|
||||
|
Loading…
Reference in New Issue
Block a user