diff options
| author | 2023-08-12 21:46:54 +0200 | |
|---|---|---|
| committer | 2023-08-12 21:46:54 +0200 | |
| commit | 07be3721c10e96f05c1b18ca3b5c5a151e331e21 (patch) | |
| tree | 86f63f614ed8c44ce4453dfd3093f2e20b3b7bc8 /httpd.c | |
| parent | Archive unattended method errors. (diff) | |
| download | snac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.tar.gz snac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.tar.xz snac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.zip | |
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) | |||
| 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); |