Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: net/spdy/hpack/hpack_decoder.cc

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_packet_maker.cc ('k') | net/spdy/hpack/hpack_decoder_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack/hpack_decoder.cc
diff --git a/net/spdy/hpack/hpack_decoder.cc b/net/spdy/hpack/hpack_decoder.cc
index 1b66851159a6879ad006933707dd2a4c996be0b0..d729919e49240f3115136ee8eceda18cf99c5f99 100644
--- a/net/spdy/hpack/hpack_decoder.cc
+++ b/net/spdy/hpack/hpack_decoder.cc
@@ -75,20 +75,16 @@ bool HpackDecoder::HandleHeaderRepresentation(StringPiece name,
}
}
- auto it = decoded_block_.find(name.as_string());
+ auto it = decoded_block_.find(name);
if (it == decoded_block_.end()) {
// This is a new key.
- decoded_block_[name.as_string()].assign(value.data(), value.size());
+ decoded_block_[name] = value;
} else {
// The key already exists, append |value| with appropriate delimiter.
- string& old_value = it->second;
- if (name == kCookieKey) {
- old_value.append("; ");
- value.AppendToString(&old_value);
- } else {
- old_value.push_back('\0');
- old_value.insert(old_value.end(), value.begin(), value.end());
- }
+ string new_value = it->second.as_string();
+ new_value.append((name == kCookieKey) ? "; " : string(1, '\0'));
+ value.AppendToString(&new_value);
+ decoded_block_.ReplaceOrAppendHeader(name, new_value);
}
return true;
}
« no previous file with comments | « net/quic/test_tools/quic_test_packet_maker.cc ('k') | net/spdy/hpack/hpack_decoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698