summaryrefslogtreecommitdiff
path: root/src/HttpServerCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-06-23 16:26:17 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-06-23 16:26:17 +0900
commit5a0a62c5f43ef461897deb6615c73325b0c0e3ca (patch)
tree6b3e8433166f6b002f90884a69d09696e534494c /src/HttpServerCommand.cc
parent9ba65aea1d8438c2b6b8eba0b380466983e6c236 (diff)
Added CORS preflight request support.
This change is based on the patch from binux.
Diffstat (limited to 'src/HttpServerCommand.cc')
-rw-r--r--src/HttpServerCommand.cc5
1 files changed, 4 insertions, 1 deletions
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");