commit 96b8791
default
·
2023-06-19 15:39:53 +0000 UTC
parent 42803e2
Defend from kbin.social messages not having a content-type header.
1 files changed,
+3,
-0
+3,
-0
1@@ -90,6 +90,9 @@ int activitypub_request(snac *snac, const char *url, xs_dict **data)
2 /* ensure it's ActivityPub data */
3 ctype = xs_dict_get(response, "content-type");
4
5+ if (xs_is_null(ctype))
6+ status = 400;
7+ else
8 if (xs_str_in(ctype, "application/activity+json") != -1 ||
9 xs_str_in(ctype, "application/ld+json") != -1)
10 *data = xs_json_loads(payload);