From 2ce1c8d28ff8b00f84e82fa6a9a3a585562c8d6d Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 19 Oct 2016 21:22:14 +0200 Subject: [PATCH] [httpd] Enable OPTIONS for evhttp (if CORS headers are enabled) --- src/httpd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/httpd.c b/src/httpd.c index 1567f1e3..642bdee6 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -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) {