Refine the connection close

This commit is contained in:
Chunting Gu
2019-07-15 15:36:30 +08:00
parent 2a20030f7e
commit 46ea52cb90
24 changed files with 214 additions and 147 deletions
+14 -2
View File
@@ -11,22 +11,34 @@ namespace webcc {
// -----------------------------------------------------------------------------
void Headers::Set(const std::string& key, const std::string& value) {
bool Headers::Set(const std::string& key, const std::string& value) {
if (value.empty()) {
return false;
}
auto it = Find(key);
if (it != headers_.end()) {
it->second = value;
} else {
headers_.push_back({ key, value });
}
return true;
}
void Headers::Set(std::string&& key, std::string&& value) {
bool Headers::Set(std::string&& key, std::string&& value) {
if (value.empty()) {
return false;
}
auto it = Find(key);
if (it != headers_.end()) {
it->second = std::move(value);
} else {
headers_.push_back({ std::move(key), std::move(value) });
}
return true;
}
bool Headers::Has(const std::string& key) const {