mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 911384 - Follow-up: tolerate explicitly falsy payloads in computeHAWK. r=rnewman
This commit is contained in:
parent
ffed248bcc
commit
0e7a78f6c8
@ -458,7 +458,9 @@ this.CryptoUtils = {
|
||||
|
||||
let contentType = CryptoUtils.stripHeaderAttributes(options.contentType);
|
||||
|
||||
if (!artifacts.hash && options.hasOwnProperty("payload")) {
|
||||
if (!artifacts.hash &&
|
||||
options.hasOwnProperty("payload") &&
|
||||
options.payload) {
|
||||
let hasher = Cc["@mozilla.org/security/hash;1"]
|
||||
.createInstance(Ci.nsICryptoHash);
|
||||
hasher.init(hash_algo);
|
||||
|
@ -188,6 +188,16 @@ add_test(function test_hawk() {
|
||||
do_check_eq(result.artifacts.hash, undefined);
|
||||
do_check_eq(result.artifacts.mac, "S3f8E4hAURAqJxOlsYugkPZxLoRYrClgbSQ/3FmKMbY=");
|
||||
|
||||
// Empty payload changes nothing.
|
||||
result = compute(makeURI("http://example.net/path"), method,
|
||||
{ credentials: credentials_sha256,
|
||||
ts: 1353809207,
|
||||
nonce: "Ygvqdz",
|
||||
payload: null,
|
||||
});
|
||||
do_check_eq(result.artifacts.hash, undefined);
|
||||
do_check_eq(result.artifacts.mac, "S3f8E4hAURAqJxOlsYugkPZxLoRYrClgbSQ/3FmKMbY=");
|
||||
|
||||
result = compute(makeURI("http://example.net/path"), method,
|
||||
{ credentials: credentials_sha256,
|
||||
ts: 1353809207,
|
||||
|
Loading…
Reference in New Issue
Block a user