Do not send Content-Length headers when they are zero.

This commit is contained in:
Thulinma 2012-08-26 22:18:26 +02:00
parent 84db148405
commit 18a1a386df

View file

@ -51,7 +51,9 @@ std::string HTTP::Parser::BuildResponse(std::string code, std::string message){
std::string tmp = protocol+" "+code+" "+message+"\n";
for (it=headers.begin(); it != headers.end(); it++){
if ((*it).first != "" && (*it).second != ""){
tmp += (*it).first + ": " + (*it).second + "\n";
if ((*it).first != "Content-Length" || (*it).second != "0"){
tmp += (*it).first + ": " + (*it).second + "\n";
}
}
}
tmp += "\n";