summaryrefslogtreecommitdiff
path: root/src/HttpServerBodyCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-23 20:59:34 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-23 20:59:34 +0900
commitdd7014a6121c0985e94451e2492a112402501335 (patch)
treef3f1ac5a8fd5a11091c28122003f31f4c172fa19 /src/HttpServerBodyCommand.cc
parent0b4dec02505a0be3dabcd01eab98f015f115bed8 (diff)
Store only interesting HTTP headers in HttpHeader
In this change, we defined HTTP header fields we are interested in. We only store those headers in HttpHeader object. Accessing HTTP headers in HttpHeader object is now done through enum values.
Diffstat (limited to 'src/HttpServerBodyCommand.cc')
-rw-r--r--src/HttpServerBodyCommand.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/HttpServerBodyCommand.cc b/src/HttpServerBodyCommand.cc
index ff9e3eb0..d986ef4d 100644
--- a/src/HttpServerBodyCommand.cc
+++ b/src/HttpServerBodyCommand.cc
@@ -169,14 +169,14 @@ bool HttpServerBodyCommand::execute()
const SharedHandle<HttpHeader>& header =
httpServer_->getRequestHeader();
std::string accessControlHeaders;
- if(!header->find("origin").empty() &&
- !header->find("access-control-request-method").empty() &&
- !httpServer_->getAllowOrigin().empty()) {
+ if(!header->find(HttpHeader::ORIGIN).empty() &&
+ !header->find(HttpHeader::ACCESS_CONTROL_REQUEST_METHOD).empty()
+ && !httpServer_->getAllowOrigin().empty()) {
accessControlHeaders +=
"Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n"
"Access-Control-Max-Age: 1728000\r\n";
const std::string& accReqHeaders =
- header->find("access-control-request-headers");
+ header->find(HttpHeader::ACCESS_CONTROL_REQUEST_HEADERS);
if(!accReqHeaders.empty()) {
// We allow all headers requested.
accessControlHeaders += "Access-Control-Allow-Headers: ";