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

Unified Diff: net/spdy/hpack_encoder.cc

Issue 533073004: HPACK: Split header fields in encoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/spdy/hpack_encoder.h ('k') | net/spdy/hpack_encoder_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_encoder.cc
diff --git a/net/spdy/hpack_encoder.cc b/net/spdy/hpack_encoder.cc
index 6cb8fad954161470b543eb8ddfc4e2ea194d27a7..64643ff75cae8262c1c03a8a4ec81a974432f4e2 100644
--- a/net/spdy/hpack_encoder.cc
+++ b/net/spdy/hpack_encoder.cc
@@ -37,11 +37,9 @@ bool HpackEncoder::EncodeHeaderSet(const std::map<string, string>& header_set,
// a map.
CookieToCrumbs(*it, &regular_headers);
} else if (it->first[0] == kPseudoHeaderPrefix) {
- pseudo_headers.push_back(make_pair(
- StringPiece(it->first), StringPiece(it->second)));
+ DecomposeRepresentation(*it, &pseudo_headers);
} else {
- regular_headers.push_back(make_pair(
- StringPiece(it->first), StringPiece(it->second)));
+ DecomposeRepresentation(*it, &regular_headers);
}
}
@@ -200,4 +198,17 @@ void HpackEncoder::CookieToCrumbs(const Representation& cookie,
out->end());
}
+// static
+void HpackEncoder::DecomposeRepresentation(const Representation& header_field,
+ Representations* out) {
+ size_t pos = 0;
+ size_t end = 0;
+ while (end != StringPiece::npos) {
+ end = header_field.second.find('\0', pos);
+ out->push_back(make_pair(header_field.first,
+ header_field.second.substr(pos, end - pos)));
+ pos = end + 1;
+ }
+}
+
} // namespace net
« no previous file with comments | « net/spdy/hpack_encoder.h ('k') | net/spdy/hpack_encoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698