Skip to content

Commit

Permalink
fix: append with comma SP to existing header if header with the same …
Browse files Browse the repository at this point in the history
…name is found
  • Loading branch information
Colin Coudray committed Jul 18, 2024
1 parent b5a21de commit 15ae2b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpr/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ Header parseHeader(const std::string& headers, std::string* status_line, std::st
std::string value = line.substr(found + 1);
value.erase(0, value.find_first_not_of("\t "));
value.resize(std::min<size_t>(value.size(), value.find_last_not_of("\t\n\r ") + 1));
header[line.substr(0, found)] = value;
if (auto it = header.find(line.substr(0, found)); it != header.end()) {
it->second = it->second + ", " + value;
} else {
header[line.substr(0, found)] = value;
}
}
}
}
Expand Down

0 comments on commit 15ae2b9

Please sign in to comment.