Md5 b64 encoding was wrong, fix it
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user