Do not send Content-Length headers when they are zero.
This commit is contained in:
parent
84db148405
commit
18a1a386df
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue