2008-05-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Rewritten Accept-Features handling.
	* src/HttpRequestCommand.cc (createHttpRequest)
pull/1/head
Tatsuhiro Tsujikawa 2008-05-11 13:14:41 +00:00
parent 1f931b33bd
commit 4e3c08d50c
2 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2008-05-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten Accept-Features handling.
* src/HttpRequestCommand.cc (createHttpRequest)
2008-05-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten accept types handling.

View File

@ -79,14 +79,15 @@ createHttpRequest(const SharedHandle<Request>& req,
httpRequest->setSegment(segment);
httpRequest->setEntityLength(totalLength);
httpRequest->addHeader(option->get(PREF_HEADER));
if(rg->getAcceptFeatures().size()) {
if(!rg->getAcceptFeatures().empty()) {
const std::deque<std::string>& acceptFeatures = rg->getAcceptFeatures();
std::string acceptFeaturesHeader = "Accept-Features: "+
Util::trim
(std::accumulate(acceptFeatures.begin()+1, acceptFeatures.end(),
*acceptFeatures.begin(),
Concat(",")),
",");
std::string acceptFeaturesHeader = "Accept-Features: "+*acceptFeatures.begin();
for(std::deque<std::string>::const_iterator i = acceptFeatures.begin()+1;
i != acceptFeatures.end(); ++i) {
acceptFeaturesHeader += ","+(*i);
}
httpRequest->addHeader(acceptFeaturesHeader);
}
httpRequest->addAcceptType(rg->getAcceptTypes().begin(),