Skip to content

Commit 00fa3c0

Browse files
authored
Merge pull request #4 from jbowes/fix-digest-verify
Fix digest verification
2 parents 6c48359 + 8550642 commit 00fa3c0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

digest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ func verifyDigest(in []byte, dig string) bool {
2626
// TODO: case insensitity for incoming digest?
2727
calc := calcDigest(in)
2828

29-
return subtle.ConstantTimeCompare([]byte(dig), []byte(calc)) == 0
29+
return subtle.ConstantTimeCompare([]byte(dig), []byte(calc)) == 1
3030
}

httpsig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func NewSignTransport(transport http.RoundTripper, opts ...signOption) http.Roun
7676

7777
// Always set a digest (for now)
7878
// TODO: we could skip setting digest on an empty body if content-length is included in the sig
79-
r.Header.Set("Digest", calcDigest(b.Bytes()))
79+
nr.Header.Set("Digest", calcDigest(b.Bytes()))
8080

8181
msg := messageFromRequest(nr)
8282
hdr, err := s.Sign(msg)

0 commit comments

Comments
 (0)