api/handlers: Implement streaming signature v4 support. (#2370)

* api/handlers: Implement streaming signature v4 support.

Fixes #2326

* tests: Add tests for quick/safe
This commit is contained in:
Harshavardhana
2016-08-08 20:56:29 -07:00
committed by GitHub
parent 0c125f3596
commit 7e46055a15
11 changed files with 835 additions and 63 deletions

View File

@@ -35,14 +35,14 @@ type File struct {
// Write writes len(b) bytes to the temporary File. In case of error, the temporary file is removed.
func (file *File) Write(b []byte) (n int, err error) {
if file.aborted {
err = errors.New("write on aborted file")
return
}
if file.closed {
err = errors.New("write on closed file")
return
}
if file.aborted {
err = errors.New("write on aborted file")
return
}
defer func() {
if err != nil {
@@ -64,7 +64,12 @@ func (file *File) Close() (err error) {
}
}()
if file.aborted || file.closed {
if file.closed {
err = errors.New("close on closed file")
return
}
if file.aborted {
err = errors.New("close on aborted file")
return
}
@@ -80,7 +85,12 @@ func (file *File) Close() (err error) {
// Abort aborts the temporary File by closing and removing the temporary file.
func (file *File) Abort() (err error) {
if file.aborted || file.closed {
if file.closed {
err = errors.New("abort on closed file")
return
}
if file.aborted {
err = errors.New("abort on aborted file")
return
}