mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
Serve the actor as the correct content-type.
This commit is contained in:
parent
57325b09f7
commit
8f738e1417
2 changed files with 8 additions and 3 deletions
|
@ -506,9 +506,12 @@ int activitypub_get_handler(d_char *req, char *q_path,
|
||||||
|
|
||||||
p_path = xs_list_get(l, 2);
|
p_path = xs_list_get(l, 2);
|
||||||
|
|
||||||
|
*ctype = "application/activity+json";
|
||||||
|
|
||||||
if (p_path == NULL) {
|
if (p_path == NULL) {
|
||||||
/* if there was no component after the user, it's an actor request */
|
/* if there was no component after the user, it's an actor request */
|
||||||
msg = msg_actor(&snac);
|
msg = msg_actor(&snac);
|
||||||
|
*ctype = "application/ld+json";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(p_path, "outbox") == 0) {
|
if (strcmp(p_path, "outbox") == 0) {
|
||||||
|
@ -532,7 +535,6 @@ int activitypub_get_handler(d_char *req, char *q_path,
|
||||||
if (status == 200 && msg != NULL) {
|
if (status == 200 && msg != NULL) {
|
||||||
*body = xs_json_dumps_pp(msg, 4);
|
*body = xs_json_dumps_pp(msg, 4);
|
||||||
*b_size = strlen(*body);
|
*b_size = strlen(*body);
|
||||||
*ctype = "application/activity+json";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user_free(&snac);
|
user_free(&snac);
|
||||||
|
|
3
http.c
3
http.c
|
@ -81,8 +81,11 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
|
||||||
hdrs = xs_dict_append(hdrs, k, v);
|
hdrs = xs_dict_append(hdrs, k, v);
|
||||||
|
|
||||||
/* add the new headers */
|
/* add the new headers */
|
||||||
|
if (strcmp(method, "POST") == 0)
|
||||||
hdrs = xs_dict_append(hdrs, "content-type", "application/activity+json");
|
hdrs = xs_dict_append(hdrs, "content-type", "application/activity+json");
|
||||||
|
else
|
||||||
hdrs = xs_dict_append(hdrs, "accept", "application/activity+json");
|
hdrs = xs_dict_append(hdrs, "accept", "application/activity+json");
|
||||||
|
|
||||||
hdrs = xs_dict_append(hdrs, "date", date);
|
hdrs = xs_dict_append(hdrs, "date", date);
|
||||||
hdrs = xs_dict_append(hdrs, "signature", signature);
|
hdrs = xs_dict_append(hdrs, "signature", signature);
|
||||||
hdrs = xs_dict_append(hdrs, "digest", digest);
|
hdrs = xs_dict_append(hdrs, "digest", digest);
|
||||||
|
|
Loading…
Reference in a new issue