Add Access-Control-Allow-Origin: * everywhere

This commit is contained in:
Kamil Trzcinski
2022-10-24 00:22:18 +02:00
parent cb7795ad2e
commit caafd0da44
4 changed files with 22 additions and 6 deletions

View File

@ -94,7 +94,6 @@ static void http_process(http_worker_t *worker, FILE *stream)
worker->user_agent[0] = 0;
worker->content_length = -1;
// request_uri
worker->request_method = worker->client_method;
@ -149,6 +148,9 @@ static void http_process(http_worker_t *worker, FILE *stream)
continue;
if (!strstr(worker->request_params, params+1))
continue;
} else if (method->uri[0] == '*') {
if (strstr(worker->request_uri, method->uri + 1) != worker->request_uri)
continue;
} else {
if (strcmp(worker->request_uri, method->uri))
continue;
@ -237,6 +239,7 @@ int http_server(http_server_options_t *options, http_method_t *methods)
worker->listen_fd = listen_fd;
worker->methods = methods;
worker->client_fd = -1;
worker->options = *options;
pthread_create(&worker->thread, NULL, (void *(*)(void*))http_worker, worker);
}