summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c18
-rw-r--r--httpd.c11
-rw-r--r--snac.h3
3 files changed, 31 insertions, 1 deletions
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)
116 116
117 return *f_content; 117 return *f_content;
118} 118}
119
120
121int 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
129int 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
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)
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>");
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,
111 char **body, int *b_size, char **ctype); 111 char **body, int *b_size, char **ctype);
112 112
113d_char *not_really_markdown(char *content, d_char **f_content); 113d_char *not_really_markdown(char *content, d_char **f_content);
114int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype);
115int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
116 char **body, int *b_size, char **ctype);