summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'http.c')
-rw-r--r--http.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/http.c b/http.c
index 6f435cb..88222a5 100644
--- a/http.c
+++ b/http.c
@@ -20,9 +20,11 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
20 xs *digest; 20 xs *digest;
21 xs *s64; 21 xs *s64;
22 xs *signature; 22 xs *signature;
23 xs *hdrs;
23 char *host; 24 char *host;
24 char *target; 25 char *target;
25 char *seckey; 26 char *seckey;
27 char *k, *v;
26 28
27 date = xs_utc_time("%a, %d %b %Y %H:%M:%S GMT"); 29 date = xs_utc_time("%a, %d %b %Y %H:%M:%S GMT");
28 30
@@ -66,14 +68,19 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
66 "signature=\"%s\"", 68 "signature=\"%s\"",
67 snac->actor, s64); 69 snac->actor, s64);
68 70
69 /* now add all these things to the headers */ 71 /* transfer the original headers */
70 headers = xs_dict_append(headers, "content-type", "application/activity+json"); 72 hdrs = xs_dict_new();
71 headers = xs_dict_append(headers, "date", date); 73 while (xs_dict_iter(&headers, &k, &v))
72 headers = xs_dict_append(headers, "signature", signature); 74 hdrs = xs_dict_append(hdrs, k, v);
73 headers = xs_dict_append(headers, "digest", digest);
74 headers = xs_dict_append(headers, "user-agent", "snac/2.x");
75 75
76// return xs_http_request(method, url, headers, 76 /* add the new headers */
77 hdrs = xs_dict_append(hdrs, "content-type", "application/activity+json");
78 hdrs = xs_dict_append(hdrs, "date", date);
79 hdrs = xs_dict_append(hdrs, "signature", signature);
80 hdrs = xs_dict_append(hdrs, "digest", digest);
81 hdrs = xs_dict_append(hdrs, "user-agent", "snac/2.x");
82
83// return xs_http_request(method, url, hdrs,
77// body, b_size, status, payload, p_size); 84// body, b_size, status, payload, p_size);
78 return NULL; 85 return NULL;
79} 86}