diff options
| author | 2022-09-26 12:29:26 +0200 | |
|---|---|---|
| committer | 2022-09-26 12:29:26 +0200 | |
| commit | 8f738e1417958a5e26fd8bfdf30fa4a166c0075a (patch) | |
| tree | 250bc6eb1be95b1f9e031a8a79c62098ac6c2590 | |
| parent | Added direction to srv_archive() files. (diff) | |
| download | snac2-8f738e1417958a5e26fd8bfdf30fa4a166c0075a.tar.gz snac2-8f738e1417958a5e26fd8bfdf30fa4a166c0075a.tar.xz snac2-8f738e1417958a5e26fd8bfdf30fa4a166c0075a.zip | |
Serve the actor as the correct content-type.
| -rw-r--r-- | activitypub.c | 4 | ||||
| -rw-r--r-- | http.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index 2e11a82..d792ce2 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -506,9 +506,12 @@ int activitypub_get_handler(d_char *req, char *q_path, | |||
| 506 | 506 | ||
| 507 | p_path = xs_list_get(l, 2); | 507 | p_path = xs_list_get(l, 2); |
| 508 | 508 | ||
| 509 | *ctype = "application/activity+json"; | ||
| 510 | |||
| 509 | if (p_path == NULL) { | 511 | if (p_path == NULL) { |
| 510 | /* if there was no component after the user, it's an actor request */ | 512 | /* if there was no component after the user, it's an actor request */ |
| 511 | msg = msg_actor(&snac); | 513 | msg = msg_actor(&snac); |
| 514 | *ctype = "application/ld+json"; | ||
| 512 | } | 515 | } |
| 513 | else | 516 | else |
| 514 | if (strcmp(p_path, "outbox") == 0) { | 517 | if (strcmp(p_path, "outbox") == 0) { |
| @@ -532,7 +535,6 @@ int activitypub_get_handler(d_char *req, char *q_path, | |||
| 532 | if (status == 200 && msg != NULL) { | 535 | if (status == 200 && msg != NULL) { |
| 533 | *body = xs_json_dumps_pp(msg, 4); | 536 | *body = xs_json_dumps_pp(msg, 4); |
| 534 | *b_size = strlen(*body); | 537 | *b_size = strlen(*body); |
| 535 | *ctype = "application/activity+json"; | ||
| 536 | } | 538 | } |
| 537 | 539 | ||
| 538 | user_free(&snac); | 540 | user_free(&snac); |
| @@ -81,8 +81,11 @@ d_char *http_signed_request(snac *snac, char *method, char *url, | |||
| 81 | hdrs = xs_dict_append(hdrs, k, v); | 81 | hdrs = xs_dict_append(hdrs, k, v); |
| 82 | 82 | ||
| 83 | /* add the new headers */ | 83 | /* add the new headers */ |
| 84 | hdrs = xs_dict_append(hdrs, "content-type", "application/activity+json"); | 84 | if (strcmp(method, "POST") == 0) |
| 85 | hdrs = xs_dict_append(hdrs, "accept", "application/activity+json"); | 85 | hdrs = xs_dict_append(hdrs, "content-type", "application/activity+json"); |
| 86 | else | ||
| 87 | hdrs = xs_dict_append(hdrs, "accept", "application/activity+json"); | ||
| 88 | |||
| 86 | hdrs = xs_dict_append(hdrs, "date", date); | 89 | hdrs = xs_dict_append(hdrs, "date", date); |
| 87 | hdrs = xs_dict_append(hdrs, "signature", signature); | 90 | hdrs = xs_dict_append(hdrs, "signature", signature); |
| 88 | hdrs = xs_dict_append(hdrs, "digest", digest); | 91 | hdrs = xs_dict_append(hdrs, "digest", digest); |