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

Rewritten Accept-Features handling.
	* src/HttpRequestCommand.cc (createHttpRequest)
pull/1/head
Tatsuhiro Tsujikawa 2008-05-12 14:07:54 +00:00
parent c1ba19efe2
commit fac64b9e07
2 changed files with 10 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2008-05-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten Accept-Features handling.
* src/HttpRequestCommand.cc (createHttpRequest)
2008-05-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Changed method signature:

View File

@ -46,7 +46,7 @@
#include "prefs.h"
#include "a2functional.h"
#include "Util.h"
#include <numeric>
#include <algorithm>
namespace aria2 {
@ -81,14 +81,10 @@ createHttpRequest(const SharedHandle<Request>& req,
httpRequest->addHeader(option->get(PREF_HEADER));
if(!rg->getAcceptFeatures().empty()) {
const std::deque<std::string>& acceptFeatures = rg->getAcceptFeatures();
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);
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());