mirror of https://github.com/aria2/aria2
Use util::strifind instead of std::toLower and std::string::find.
parent
2f4393d17c
commit
f0f1cfab5c
|
@ -445,10 +445,9 @@ bool HttpRequest::conditionalRequest() const
|
||||||
static const char A2_IF_NONE_MATCH[] = "if-none-match";
|
static const char A2_IF_NONE_MATCH[] = "if-none-match";
|
||||||
for(std::vector<std::string>::const_iterator i = headers_.begin(),
|
for(std::vector<std::string>::const_iterator i = headers_.begin(),
|
||||||
eoi = headers_.end(); i != eoi; ++i) {
|
eoi = headers_.end(); i != eoi; ++i) {
|
||||||
std::string hd = util::toLower(*i);
|
if(util::istartsWith((*i).begin(), (*i).end(),
|
||||||
if(util::startsWith(hd.begin(), hd.end(),
|
|
||||||
A2_IF_MOD_SINCE, vend(A2_IF_MOD_SINCE)-1) ||
|
A2_IF_MOD_SINCE, vend(A2_IF_MOD_SINCE)-1) ||
|
||||||
util::startsWith(hd.begin(), hd.end(),
|
util::istartsWith((*i).begin(), (*i).end(),
|
||||||
A2_IF_NONE_MATCH, vend(A2_IF_NONE_MATCH)-1)) {
|
A2_IF_NONE_MATCH, vend(A2_IF_NONE_MATCH)-1)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,12 +93,18 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest()
|
||||||
lastRequestHeader_->findAsUInt(HttpHeader::CONTENT_LENGTH);
|
lastRequestHeader_->findAsUInt(HttpHeader::CONTENT_LENGTH);
|
||||||
headerProcessor_->clear();
|
headerProcessor_->clear();
|
||||||
|
|
||||||
std::string connection =
|
const std::string& connection =
|
||||||
util::toLower(lastRequestHeader_->find(HttpHeader::CONNECTION));
|
lastRequestHeader_->find(HttpHeader::CONNECTION);
|
||||||
acceptsPersistentConnection_ =
|
acceptsPersistentConnection_ =
|
||||||
connection.find(HttpHeader::CLOSE) == std::string::npos &&
|
util::strifind(connection.begin(),
|
||||||
|
connection.end(),
|
||||||
|
HttpHeader::CLOSE.begin(),
|
||||||
|
HttpHeader::CLOSE.end()) == connection.end() &&
|
||||||
(lastRequestHeader_->getVersion() == HttpHeader::HTTP_1_1 ||
|
(lastRequestHeader_->getVersion() == HttpHeader::HTTP_1_1 ||
|
||||||
connection.find("keep-alive") != std::string::npos);
|
util::strifind(connection.begin(),
|
||||||
|
connection.end(),
|
||||||
|
HttpHeader::KEEP_ALIVE.begin(),
|
||||||
|
HttpHeader::KEEP_ALIVE.end()) != connection.end());
|
||||||
|
|
||||||
std::vector<Scip> acceptEncodings;
|
std::vector<Scip> acceptEncodings;
|
||||||
const std::string& acceptEnc =
|
const std::string& acceptEnc =
|
||||||
|
|
Loading…
Reference in New Issue