Skip to content

Commit

Permalink
fix #597: DumpHeaders duplicated cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
ithewei committed Jul 29, 2024
1 parent 6dd31fc commit 206af89
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions http/HttpMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,13 @@ void HttpMessage::DumpHeaders(std::string& str) {
if (type == HTTP_RESPONSE) {
cookie_field = "Set-Cookie";
}
for (auto& cookie : cookies) {
str += cookie_field;
str += ": ";
str += cookie.dump();
str += "\r\n";
if (headers.find(cookie_field) == headers.end()) {
for (auto& cookie : cookies) {
str += cookie_field;
str += ": ";
str += cookie.dump();
str += "\r\n";
}
}
}

Expand Down

0 comments on commit 206af89

Please sign in to comment.