summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorGravatar default2022-09-25 18:54:05 +0200
committerGravatar default2022-09-25 18:54:05 +0200
commitfcf9329449e59fe4cce179ad4e5282d87ed5f1f4 (patch)
tree2ce18f9413871c623fd4825fa0e6058d19d3475e /http.c
parentFixed a bug in the digest header. (diff)
downloadsnac2-fcf9329449e59fe4cce179ad4e5282d87ed5f1f4.tar.gz
snac2-fcf9329449e59fe4cce179ad4e5282d87ed5f1f4.tar.xz
snac2-fcf9329449e59fe4cce179ad4e5282d87ed5f1f4.zip
Minor tweak in http signatures.
Diffstat (limited to 'http.c')
-rw-r--r--http.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/http.c b/http.c
index 65d934c..79ad239 100644
--- a/http.c
+++ b/http.c
@@ -17,7 +17,7 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
17{ 17{
18 xs *l1; 18 xs *l1;
19 xs *date; 19 xs *date;
20 xs *digest_b64, *digest; 20 xs *digest;
21 xs *s64; 21 xs *s64;
22 xs *signature; 22 xs *signature;
23 xs *hdrs; 23 xs *hdrs;
@@ -43,12 +43,16 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
43 target = ""; 43 target = "";
44 44
45 /* digest */ 45 /* digest */
46 if (body != NULL) 46 {
47 digest_b64 = xs_sha256_base64(body, b_size); 47 xs *s;
48 else
49 digest_b64 = xs_sha256_base64("", 0);
50 48
51 digest = xs_fmt("SHA-256=%s", digest_b64); 49 if (body != NULL)
50 s = xs_sha256_base64(body, b_size);
51 else
52 s = xs_sha256_base64("", 0);
53
54 digest = xs_fmt("SHA-256=%s", s);
55 }
52 56
53 seckey = xs_dict_get(snac->key, "secret"); 57 seckey = xs_dict_get(snac->key, "secret");
54 58