diff options
author | default <nobody@localhost> | 2023-08-12 21:46:54 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-08-12 21:46:54 +0200 |
commit | 07be3721c10e96f05c1b18ca3b5c5a151e331e21 (patch) | |
tree | 86f63f614ed8c44ce4453dfd3093f2e20b3b7bc8 /httpd.c | |
parent | 94149d262d0ec40fb72b68965e5b396a6756bb1a (diff) |
Some mastoapi tweaks to support the semaphore.social web client.
Diffstat (limited to 'httpd.c')
-rw-r--r-- | httpd.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -153,7 +153,7 @@ void httpd_connection(FILE *f) d_char *body = NULL; int b_size = 0; char *ctype = NULL; - xs *headers = NULL; + xs *headers = xs_dict_new(); xs *q_path = NULL; xs *payload = NULL; xs *etag = NULL; @@ -232,9 +232,10 @@ void httpd_connection(FILE *f) #endif } - - /* let's go */ - headers = xs_dict_new(); + else + if (strcmp(method, "OPTIONS") == 0) { + status = 200; + } /* unattended? it's an error */ if (status == 0) { @@ -275,6 +276,9 @@ void httpd_connection(FILE *f) if (strcmp(method, "HEAD") == 0) body = xs_free(body); + headers = xs_dict_append(headers, "access-control-allow-origin", "*"); + headers = xs_dict_append(headers, "access-control-allow-headers", "*"); + xs_httpd_response(f, status, headers, body, b_size); fclose(f); |