diff options
| -rw-r--r-- | html.c | 18 | ||||
| -rw-r--r-- | httpd.c | 11 | ||||
| -rw-r--r-- | snac.h | 3 |
3 files changed, 31 insertions, 1 deletions
| @@ -116,3 +116,21 @@ d_char *not_really_markdown(char *content, d_char **f_content) | |||
| 116 | 116 | ||
| 117 | return *f_content; | 117 | return *f_content; |
| 118 | } | 118 | } |
| 119 | |||
| 120 | |||
| 121 | int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype) | ||
| 122 | { | ||
| 123 | int status = 0; | ||
| 124 | |||
| 125 | return status; | ||
| 126 | } | ||
| 127 | |||
| 128 | |||
| 129 | int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | ||
| 130 | char **body, int *b_size, char **ctype) | ||
| 131 | { | ||
| 132 | int status = 0; | ||
| 133 | |||
| 134 | return status; | ||
| 135 | } | ||
| 136 | |||
| @@ -127,20 +127,29 @@ void httpd_connection(int rs) | |||
| 127 | 127 | ||
| 128 | if (status == 0) | 128 | if (status == 0) |
| 129 | status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype); | 129 | status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype); |
| 130 | |||
| 131 | if (status == 0) | ||
| 132 | status = html_get_handler(req, q_path, &body, &b_size, &ctype); | ||
| 130 | } | 133 | } |
| 131 | else | 134 | else |
| 132 | if (strcmp(method, "POST") == 0) { | 135 | if (strcmp(method, "POST") == 0) { |
| 133 | if (status == 0) | 136 | if (status == 0) |
| 134 | status = activitypub_post_handler(req, q_path, | 137 | status = activitypub_post_handler(req, q_path, |
| 135 | payload, p_size, &body, &b_size, &ctype); | 138 | payload, p_size, &body, &b_size, &ctype); |
| 139 | |||
| 140 | if (status == 0) | ||
| 141 | status = html_post_handler(req, q_path, | ||
| 142 | payload, p_size, &body, &b_size, &ctype); | ||
| 136 | } | 143 | } |
| 137 | 144 | ||
| 138 | /* let's go */ | 145 | /* let's go */ |
| 139 | headers = xs_dict_new(); | 146 | headers = xs_dict_new(); |
| 140 | 147 | ||
| 141 | /* unattended? it's an error */ | 148 | /* unattended? it's an error */ |
| 142 | if (status == 0) | 149 | if (status == 0) { |
| 150 | srv_debug(1, xs_fmt("httpd_connection unattended %s %s", method, q_path)); | ||
| 143 | status = 404; | 151 | status = 404; |
| 152 | } | ||
| 144 | 153 | ||
| 145 | if (status == 404) | 154 | if (status == 404) |
| 146 | body = xs_str_new("<h1>404 Not Found</h1>"); | 155 | body = xs_str_new("<h1>404 Not Found</h1>"); |
| @@ -111,3 +111,6 @@ int activitypub_post_handler(d_char *req, char *q_path, | |||
| 111 | char **body, int *b_size, char **ctype); | 111 | char **body, int *b_size, char **ctype); |
| 112 | 112 | ||
| 113 | d_char *not_really_markdown(char *content, d_char **f_content); | 113 | d_char *not_really_markdown(char *content, d_char **f_content); |
| 114 | int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype); | ||
| 115 | int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | ||
| 116 | char **body, int *b_size, char **ctype); | ||