summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-05-27 14:40:58 +0200
committerJo-Philipp Wich <jow@openwrt.org>2014-06-10 12:33:59 +0200
commitb965b8cc10f094ec0408d57b1bc9aeee0bca501c (patch)
tree2f3b7f753b0b3f414032f978243da8945def7a18 /utils.c
parentdabd7dea6445aaa0e5b8d9add1872fa7393b3a85 (diff)
ubus: add CORS header support
In order to support cross-domain AJAX requests to the /ubus endpoint we need to implement the Cross-Origin Resource Sharing (CORS) spec in the ubus plugin. - Implement a new option "-X" to enable CORS support in ubus - Implement rudimentary support for "OPTIONS" HTTP requests - Implement essential CORS headers the ubus plugin The current CORS response headers merely reflect the request headers sent by the client, this way any requesting origin is automatically allowed. Cross-domain cookies (Access-Control-Allow-Credentials) are unconditionally enabled. Restricting permitted origins and toggle the credential accepting can be made configurable in a future commit to allow more fine grained control over permitted AJAX clients. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index b1d7d37..1c21fc5 100644
--- a/utils.c
+++ b/utils.c
@@ -25,7 +25,7 @@ bool uh_use_chunked(struct client *cl)
if (cl->request.version != UH_HTTP_VER_1_1)
return false;
- if (cl->request.method == UH_HTTP_MSG_HEAD)
+ if (cl->request.method == UH_HTTP_MSG_HEAD || cl->request.method == UH_HTTP_MSG_OPTIONS)
return false;
return true;