From dc864527133f7febe444193f71606a0e9f406ada Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 2 May 2015 20:34:35 -0700 Subject: [PATCH] Minor change use .Write() instead of io.WriteString() --- pkg/client/s3/auth.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/client/s3/auth.go b/pkg/client/s3/auth.go index 841e9de5..7964476f 100644 --- a/pkg/client/s3/auth.go +++ b/pkg/client/s3/auth.go @@ -19,7 +19,6 @@ package s3 import ( "bytes" "fmt" - "io" "io/ioutil" "net" "net/http" @@ -85,13 +84,15 @@ func (a *s3Client) signRequest(req *http.Request, host string) { hm := hmac.New(sha1.New, []byte(a.SecretAccessKey)) ss := a.stringToSign(req, host) //DEBUG - fmt.Printf("String to sign: %q (%x)\n", ss, ss) - io.WriteString(hm, ss) + hm.Write([]byte(ss)) authHeader := new(bytes.Buffer) fmt.Fprintf(authHeader, "AWS %s:", a.AccessKeyID) encoder := base64.NewEncoder(base64.StdEncoding, authHeader) encoder.Write(hm.Sum(nil)) + // do not defer this, close it before passing down encoded authHeader encoder.Close() + req.Header.Set("Authorization", authHeader.String()) }