Md5 b64 encoding was wrong, fix it

This commit is contained in:
Harshavardhana
2015-03-07 16:35:42 -08:00
parent 2981e6688a
commit d1ce84d26e
3 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ func (a *Auth) signRequest(req *http.Request) {
}
hm := hmac.New(sha1.New, []byte(a.SecretAccessKey))
ss := a.stringToSign(req)
//log.Printf("String to sign: %q (%x)", ss, ss)
//fmt.Printf("String to sign: %q (%x)\n", ss, ss)
io.WriteString(hm, ss)
authHeader := new(bytes.Buffer)
+2 -5
View File
@@ -231,11 +231,8 @@ func (c *Client) Put(bucket, key string, size int64, contents io.Reader) error {
return err
}
req.Body = ioutil.NopCloser(sink)
b64 := new(bytes.Buffer)
encoder := base64.NewEncoder(base64.StdEncoding, b64)
encoder.Write(h.Sum(nil))
req.Header.Set("Content-MD5", b64.String())
b64 := base64.StdEncoding.EncodeToString(h.Sum(nil))
req.Header.Set("Content-MD5", b64)
c.Auth.signRequest(req)
res, err := c.transport().RoundTrip(req)
+1 -1
View File
@@ -120,7 +120,7 @@ func doFsCopy(c *cli.Context) {
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s uploaded -- to bucket:%s", fsoptions.key, fsoptions.bucket)
fmt.Printf("%s uploaded -- to bucket:%s\n", fsoptions.key, fsoptions.bucket)
} else if fsoptions.isget {
var objectReader io.ReadCloser
var objectSize int64