[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

View File

@ -1442,8 +1442,13 @@ httpd_init(void)
// For CORS headers
allow_origin = cfg_getstr(cfg_getsec(cfg, "general"), "allow_origin");
if (allow_origin && (strlen(allow_origin) == 0))
allow_origin = NULL;
if (allow_origin)
{
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)
{