From 5a0a62c5f43ef461897deb6615c73325b0c0e3ca Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 23 Jun 2012 16:26:17 +0900 Subject: Added CORS preflight request support. This change is based on the patch from binux. --- src/HttpServerCommand.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/HttpServerCommand.cc') diff --git a/src/HttpServerCommand.cc b/src/HttpServerCommand.cc index 0e13094e..5c79112f 100644 --- a/src/HttpServerCommand.cc +++ b/src/HttpServerCommand.cc @@ -164,7 +164,10 @@ bool HttpServerCommand::execute() e_->addCommand(this); return false; } - if(!httpServer_->authenticate()) { + // CORS preflight request uses OPTIONS method. It is not + // restricted by authentication. + if(!httpServer_->authenticate() && + httpServer_->getMethod() != "OPTIONS") { httpServer_->disableKeepAlive(); httpServer_->feedResponse (401, "WWW-Authenticate: Basic realm=\"aria2\"\r\n"); -- cgit