summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'httpd.c')
-rw-r--r--httpd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/httpd.c b/httpd.c
index 3fafeb0..1145abd 100644
--- a/httpd.c
+++ b/httpd.c
@@ -153,7 +153,7 @@ void httpd_connection(FILE *f)
153 d_char *body = NULL; 153 d_char *body = NULL;
154 int b_size = 0; 154 int b_size = 0;
155 char *ctype = NULL; 155 char *ctype = NULL;
156 xs *headers = NULL; 156 xs *headers = xs_dict_new();
157 xs *q_path = NULL; 157 xs *q_path = NULL;
158 xs *payload = NULL; 158 xs *payload = NULL;
159 xs *etag = NULL; 159 xs *etag = NULL;
@@ -232,9 +232,10 @@ void httpd_connection(FILE *f)
232#endif 232#endif
233 233
234 } 234 }
235 235 else
236 /* let's go */ 236 if (strcmp(method, "OPTIONS") == 0) {
237 headers = xs_dict_new(); 237 status = 200;
238 }
238 239
239 /* unattended? it's an error */ 240 /* unattended? it's an error */
240 if (status == 0) { 241 if (status == 0) {
@@ -275,6 +276,9 @@ void httpd_connection(FILE *f)
275 if (strcmp(method, "HEAD") == 0) 276 if (strcmp(method, "HEAD") == 0)
276 body = xs_free(body); 277 body = xs_free(body);
277 278
279 headers = xs_dict_append(headers, "access-control-allow-origin", "*");
280 headers = xs_dict_append(headers, "access-control-allow-headers", "*");
281
278 xs_httpd_response(f, status, headers, body, b_size); 282 xs_httpd_response(f, status, headers, body, b_size);
279 283
280 fclose(f); 284 fclose(f);