diff --git a/ChangeLog b/ChangeLog index 7ab44fab..958c208d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-12 Tatsuhiro Tsujikawa + + Rewritten Accept-Features handling. + * src/HttpRequestCommand.cc (createHttpRequest) + 2008-05-12 Tatsuhiro Tsujikawa Changed method signature: diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc index 0eef8246..5e15c532 100644 --- a/src/HttpRequestCommand.cc +++ b/src/HttpRequestCommand.cc @@ -46,7 +46,7 @@ #include "prefs.h" #include "a2functional.h" #include "Util.h" -#include +#include namespace aria2 { @@ -81,14 +81,10 @@ createHttpRequest(const SharedHandle& req, httpRequest->addHeader(option->get(PREF_HEADER)); if(!rg->getAcceptFeatures().empty()) { const std::deque& acceptFeatures = rg->getAcceptFeatures(); - - std::string acceptFeaturesHeader = "Accept-Features: "+*acceptFeatures.begin(); - for(std::deque::const_iterator i = acceptFeatures.begin()+1; - i != acceptFeatures.end(); ++i) { - acceptFeaturesHeader += ","+(*i); - } - - httpRequest->addHeader(acceptFeaturesHeader); + std::string acceptFeaturesHeader = "Accept-Features: "; + std::for_each(acceptFeatures.begin(), acceptFeatures.end(), + StringAppend(acceptFeaturesHeader, ",")); + httpRequest->addHeader(Util::trim(acceptFeaturesHeader, ",")); } httpRequest->addAcceptType(rg->getAcceptTypes().begin(), rg->getAcceptTypes().end());