[httpd] Enable OPTIONS for evhttp (if CORS headers are enabled)

This commit is contained in:
ejurgensen 2016-10-19 21:22:14 +02:00
parent 54a09fce63
commit 2ce1c8d28f
1 changed files with 7 additions and 2 deletions

View File

@ -1442,8 +1442,13 @@ httpd_init(void)
// For CORS headers // For CORS headers
allow_origin = cfg_getstr(cfg_getsec(cfg, "general"), "allow_origin"); allow_origin = cfg_getstr(cfg_getsec(cfg, "general"), "allow_origin");
if (allow_origin && (strlen(allow_origin) == 0)) if (allow_origin)
allow_origin = NULL; {
if (strlen(allow_origin) != 0)
evhttp_set_allowed_methods(evhttpd, EVHTTP_REQ_GET | EVHTTP_REQ_POST | EVHTTP_REQ_OPTIONS);
else
allow_origin = NULL;
}
if (v6enabled) if (v6enabled)
{ {