summaryrefslogtreecommitdiff
path: root/httpd.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-12 21:46:54 +0200
committerdefault <nobody@localhost>2023-08-12 21:46:54 +0200
commit07be3721c10e96f05c1b18ca3b5c5a151e331e21 (patch)
tree86f63f614ed8c44ce4453dfd3093f2e20b3b7bc8 /httpd.c
parent94149d262d0ec40fb72b68965e5b396a6756bb1a (diff)
Some mastoapi tweaks to support the semaphore.social web client.
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)
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);