summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c6
-rw-r--r--httpd.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index cfe3eea..6d017c6 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -2323,6 +2323,12 @@ int activitypub_post_handler(const xs_dict *req, const char *q_path,
2323 return 400; 2323 return 400;
2324 } 2324 }
2325 2325
2326 if (xs_is_null(payload)) {
2327 *body = xs_str_new("no payload");
2328 *ctype = "text/plain";
2329 return 400;
2330 }
2331
2326 if (xs_str_in(i_ctype, "application/activity+json") == -1 && 2332 if (xs_str_in(i_ctype, "application/activity+json") == -1 &&
2327 xs_str_in(i_ctype, "application/ld+json") == -1) 2333 xs_str_in(i_ctype, "application/ld+json") == -1)
2328 return 0; 2334 return 0;
diff --git a/httpd.c b/httpd.c
index 197a6c0..d401d7d 100644
--- a/httpd.c
+++ b/httpd.c
@@ -382,7 +382,7 @@ void httpd_connection(FILE *f)
382 srv_archive("RECV", NULL, req, payload, p_size, status, headers, body, b_size); 382 srv_archive("RECV", NULL, req, payload, p_size, status, headers, body, b_size);
383 383
384 /* JSON validation check */ 384 /* JSON validation check */
385 if (strcmp(ctype, "application/json") == 0) { 385 if (!xs_is_null(body) && strcmp(ctype, "application/json") == 0) {
386 xs *j = xs_json_loads(body); 386 xs *j = xs_json_loads(body);
387 387
388 if (j == NULL) { 388 if (j == NULL) {