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