mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Added dummy HTTP handlers for html.
This commit is contained in:
parent
3b8a43013d
commit
b2c8264003
3 changed files with 31 additions and 1 deletions
18
html.c
18
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;
|
||||
}
|
||||
|
||||
|
|
11
httpd.c
11
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("<h1>404 Not Found</h1>");
|
||||
|
|
3
snac.h
3
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);
|
||||
|
|
Loading…
Reference in a new issue