diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-09-23 21:46:01 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-09-23 21:46:01 +0900 |
| commit | 54665ff4093f4517104fe36c1b58f9a339710adf (patch) | |
| tree | c946194194f84032d0ace485d113828404364820 /src/HttpServer.cc | |
| parent | dd7014a6121c0985e94451e2492a112402501335 (diff) | |
Removed static std::string constant in HttpHeader
This change also removes inspection of Proxy-Connection header field
when checking whether the remote endpoint keeps connection open.
Diffstat (limited to 'src/HttpServer.cc')
| -rw-r--r-- | src/HttpServer.cc | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 53145037..b7f467b1 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -71,7 +71,6 @@ HttpServer::HttpServer reqType_(RPC_TYPE_NONE), keepAlive_(true), gzip_(false), - acceptsPersistentConnection_(true), acceptsGZip_(false) {} @@ -156,19 +155,6 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest() } headerProcessor_->clear(); - const std::string& connection = - lastRequestHeader_->find(HttpHeader::CONNECTION); - acceptsPersistentConnection_ = - util::strifind(connection.begin(), - connection.end(), - HttpHeader::CLOSE.begin(), - HttpHeader::CLOSE.end()) == connection.end() && - (lastRequestHeader_->getVersion() == HttpHeader::HTTP_1_1 || - util::strifind(connection.begin(), - connection.end(), - HttpHeader::KEEP_ALIVE.begin(), - HttpHeader::KEEP_ALIVE.end()) != connection.end()); - std::vector<Scip> acceptEncodings; const std::string& acceptEnc = lastRequestHeader_->find(HttpHeader::ACCEPT_ENCODING); @@ -177,8 +163,7 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest() acceptsGZip_ = false; for(std::vector<Scip>::const_iterator i = acceptEncodings.begin(), eoi = acceptEncodings.end(); i != eoi; ++i) { - if(util::strieq((*i).first, (*i).second, - HttpHeader::GZIP.begin(), HttpHeader::GZIP.end())) { + if(util::strieq((*i).first, (*i).second, "gzip")) { acceptsGZip_ = true; break; } @@ -392,4 +377,10 @@ std::string HttpServer::createQuery() const } } +bool HttpServer::supportsPersistentConnection() const +{ + return keepAlive_ && + lastRequestHeader_ && lastRequestHeader_->isKeepAlive(); +} + } // namespace aria2 |
