Adds a test case demonstrating that when HPACK compression is disabled and incremental encoding is used, spdy::HpackEncoder emits \0-delimited values on the wire.
HPACK compression is always enabled in production.
http://cs/search/?q=gfe2_http2_compress_headers_to
gfe-relnote: n/a (test only)
PiperOrigin-RevId: 284839022
Change-Id: Ifdd79eb2008b239b685732d9e999ea981a0aeef2
diff --git a/spdy/core/hpack/hpack_encoder_test.cc b/spdy/core/hpack/hpack_encoder_test.cc
index 5a74d0f..9df4f26 100644
--- a/spdy/core/hpack/hpack_encoder_test.cc
+++ b/spdy/core/hpack/hpack_encoder_test.cc
@@ -336,19 +336,37 @@
ExpectNonIndexedLiteral(":path", "/index.html");
ExpectNonIndexedLiteral("cookie", "foo=bar");
ExpectNonIndexedLiteral("cookie", "baz=bing");
- ExpectNonIndexedLiteral("hello", "goodbye");
+ if (use_incremental_) {
+ // BUG: encodes as a \0-delimited value. Should be separate entries.
+ ExpectNonIndexedLiteral("hello", std::string("goodbye\0aloha", 13));
+ } else {
+ ExpectNonIndexedLiteral("hello", "goodbye");
+ ExpectNonIndexedLiteral("hello", "aloha");
+ }
SpdyHeaderBlock headers;
headers[":path"] = "/index.html";
headers["cookie"] = "foo=bar; baz=bing";
headers["hello"] = "goodbye";
+ headers.AppendValueOrAddHeader("hello", "aloha");
CompareWithExpectedEncoding(headers);
- EXPECT_THAT(
- headers_observed_,
- ElementsAre(Pair(":path", "/index.html"), Pair("cookie", "foo=bar"),
- Pair("cookie", "baz=bing"), Pair("hello", "goodbye")));
+ if (use_incremental_) {
+ // BUG: value for "hello" encodes as \0-delimited. Should be separate
+ // entries.
+ EXPECT_THAT(
+ headers_observed_,
+ ElementsAre(Pair(":path", "/index.html"), Pair("cookie", "foo=bar"),
+ Pair("cookie", "baz=bing"),
+ Pair("hello", std::string("goodbye\0aloha", 13))));
+ } else {
+ EXPECT_THAT(
+ headers_observed_,
+ ElementsAre(Pair(":path", "/index.html"), Pair("cookie", "foo=bar"),
+ Pair("cookie", "baz=bing"), Pair("hello", "goodbye"),
+ Pair("hello", "aloha")));
+ }
}
TEST_P(HpackEncoderTest, MultipleEncodingPasses) {