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

@ -18,6 +18,8 @@ void http_write_response(
fprintf(stream, "Content-Type: %s\r\n", content_type ? content_type : "text/plain");
if (content_length > 0)
fprintf(stream, "Content-Length: %d\r\n", content_length);
if (!status || strstr(status, "200 OK") == status)
fprintf(stream, "Access-Control-Allow-Origin: *\r\n");
fprintf(stream, "\r\n");
if (body) {
fwrite(body, 1, content_length, stream);