Skip to content

Commit

Permalink
fix chunk reading
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Sep 13, 2023
1 parent f354909 commit f83ccbf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 201 deletions.
71 changes: 0 additions & 71 deletions chunk.go

This file was deleted.

116 changes: 0 additions & 116 deletions chunk_test.go

This file was deleted.

15 changes: 1 addition & 14 deletions gofakes3.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,22 +698,9 @@ func (g *GoFakeS3) createObject(bucket, object string, w http.ResponseWriter, r
}
}

var reader io.Reader

if sha, ok := meta["X-Amz-Content-Sha256"]; ok && sha == "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" {
reader = newChunkedReader(r.Body)
size, err = strconv.ParseInt(meta["X-Amz-Decoded-Content-Length"], 10, 64)
if err != nil {
w.WriteHeader(http.StatusBadRequest) // XXX: no code for this, according to s3tests
return nil
}
} else {
reader = r.Body
}

// hashingReader is still needed to get the ETag even if integrityCheck
// is set to false:
rdr, err := newHashingReader(reader, md5Base64)
rdr, err := newHashingReader(r.Body, md5Base64)
defer r.Body.Close()
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions signature/signature-v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/subtle"
"encoding/hex"
"errors"
"fmt"
"io"
"net/http"
"sort"
Expand Down Expand Up @@ -231,6 +232,7 @@ func authTypeStreamingVerify(r *http.Request, authType authType) ErrorCode {
}
r.Body = rc
r.ContentLength = size
r.Header.Set("Content-Length", fmt.Sprint(size))
return ErrNone
}

Expand Down

0 comments on commit f83ccbf

Please sign in to comment.