diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 15:59:15 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 16:39:21 +0200 |
commit | 863486a6b71ed0e562a3965bed56465d007b1418 (patch) | |
tree | e93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go | |
parent | 49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff) | |
download | terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.gz terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.zst terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.zip |
update vendor and go.modadd_contact_groups
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 523db79..8104793 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go | |||
@@ -687,7 +687,11 @@ func (ctx *signingCtx) buildBodyDigest() error { | |||
687 | if !aws.IsReaderSeekable(ctx.Body) { | 687 | if !aws.IsReaderSeekable(ctx.Body) { |
688 | return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) | 688 | return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) |
689 | } | 689 | } |
690 | hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) | 690 | hashBytes, err := makeSha256Reader(ctx.Body) |
691 | if err != nil { | ||
692 | return err | ||
693 | } | ||
694 | hash = hex.EncodeToString(hashBytes) | ||
691 | } | 695 | } |
692 | 696 | ||
693 | if includeSHA256Header { | 697 | if includeSHA256Header { |
@@ -734,10 +738,16 @@ func makeSha256(data []byte) []byte { | |||
734 | return hash.Sum(nil) | 738 | return hash.Sum(nil) |
735 | } | 739 | } |
736 | 740 | ||
737 | func makeSha256Reader(reader io.ReadSeeker) []byte { | 741 | func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { |
738 | hash := sha256.New() | 742 | hash := sha256.New() |
739 | start, _ := reader.Seek(0, sdkio.SeekCurrent) | 743 | start, err := reader.Seek(0, sdkio.SeekCurrent) |
740 | defer reader.Seek(start, sdkio.SeekStart) | 744 | if err != nil { |
745 | return nil, err | ||
746 | } | ||
747 | defer func() { | ||
748 | // ensure error is return if unable to seek back to start of payload. | ||
749 | _, err = reader.Seek(start, sdkio.SeekStart) | ||
750 | }() | ||
741 | 751 | ||
742 | // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies | 752 | // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies |
743 | // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. | 753 | // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. |
@@ -748,7 +758,7 @@ func makeSha256Reader(reader io.ReadSeeker) []byte { | |||
748 | io.CopyN(hash, reader, size) | 758 | io.CopyN(hash, reader, size) |
749 | } | 759 | } |
750 | 760 | ||
751 | return hash.Sum(nil) | 761 | return hash.Sum(nil), nil |
752 | } | 762 | } |
753 | 763 | ||
754 | const doubleSpace = " " | 764 | const doubleSpace = " " |