From b2c826400343cb0e56bf565b8b9c3072c998c22d Mon Sep 17 00:00:00 2001 From: default Date: Wed, 28 Sep 2022 05:22:08 +0200 Subject: [PATCH] Added dummy HTTP handlers for html. --- html.c | 18 ++++++++++++++++++ httpd.c | 11 ++++++++++- snac.h | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/html.c b/html.c index db7d10e..0a070b2 100644 --- a/html.c +++ b/html.c @@ -116,3 +116,21 @@ d_char *not_really_markdown(char *content, d_char **f_content) return *f_content; } + + +int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype) +{ + int status = 0; + + return status; +} + + +int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, + char **body, int *b_size, char **ctype) +{ + int status = 0; + + return status; +} + diff --git a/httpd.c b/httpd.c index 447d30c..3ff13c6 100644 --- a/httpd.c +++ b/httpd.c @@ -127,20 +127,29 @@ void httpd_connection(int rs) if (status == 0) status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype); + + if (status == 0) + status = html_get_handler(req, q_path, &body, &b_size, &ctype); } else if (strcmp(method, "POST") == 0) { if (status == 0) status = activitypub_post_handler(req, q_path, payload, p_size, &body, &b_size, &ctype); + + if (status == 0) + status = html_post_handler(req, q_path, + payload, p_size, &body, &b_size, &ctype); } /* let's go */ headers = xs_dict_new(); /* unattended? it's an error */ - if (status == 0) + if (status == 0) { + srv_debug(1, xs_fmt("httpd_connection unattended %s %s", method, q_path)); status = 404; + } if (status == 404) body = xs_str_new("

404 Not Found

"); diff --git a/snac.h b/snac.h index 209acb2..904f947 100644 --- a/snac.h +++ b/snac.h @@ -111,3 +111,6 @@ int activitypub_post_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype); d_char *not_really_markdown(char *content, d_char **f_content); +int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype); +int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, + char **body, int *b_size, char **ctype);