1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/spdy/hpack_decoder.h"
10 #include "base/basictypes.h"
11 #include "base/logging.h"
12 #include "base/strings/string_piece.h"
13 #include "net/spdy/hpack_encoder.h"
14 #include "net/spdy/hpack_input_stream.h"
15 #include "net/spdy/hpack_output_stream.h"
16 #include "net/spdy/spdy_test_utils.h"
17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h"
24 using base::StringPiece;
27 class HpackDecoderPeer {
29 explicit HpackDecoderPeer(HpackDecoder* decoder)
30 : decoder_(decoder) {}
32 void HandleHeaderRepresentation(StringPiece name, StringPiece value) {
33 decoder_->HandleHeaderRepresentation(name, value);
35 bool DecodeNextName(HpackInputStream* in, StringPiece* out) {
36 return decoder_->DecodeNextName(in, out);
38 HpackHeaderTable* header_table() {
39 return &decoder_->header_table_;
41 void set_cookie_value(string value) {
42 decoder_->cookie_value_ = value;
44 string cookie_value() {
45 return decoder_->cookie_value_;
47 const std::map<string, string>& decoded_block() const {
48 return decoder_->decoded_block_;
50 const string& headers_block_buffer() const {
51 return decoder_->headers_block_buffer_;
55 HpackDecoder* decoder_;
62 using base::StringPiece;
66 using testing::ElementsAre;
69 const size_t kLiteralBound = 1024;
71 class HpackDecoderTest : public ::testing::Test {
74 : decoder_(ObtainHpackHuffmanTable()),
75 decoder_peer_(&decoder_) {}
77 bool DecodeHeaderBlock(StringPiece str) {
78 return decoder_.HandleControlFrameHeadersData(0, str.data(), str.size()) &&
79 decoder_.HandleControlFrameHeadersComplete(0);
82 const std::map<string, string>& decoded_block() const {
83 // TODO(jgraettinger): HpackDecoderTest should implement
84 // SpdyHeadersHandlerInterface, and collect headers for examination.
85 return decoder_peer_.decoded_block();
88 const std::map<string, string>& DecodeBlockExpectingSuccess(StringPiece str) {
89 EXPECT_TRUE(DecodeHeaderBlock(str));
90 return decoded_block();
93 void expectEntry(size_t index, size_t size, const string& name,
94 const string& value) {
95 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index);
96 EXPECT_EQ(name, entry->name()) << "index " << index;
97 EXPECT_EQ(value, entry->value());
98 EXPECT_EQ(size, entry->Size());
99 EXPECT_EQ(index, decoder_peer_.header_table()->IndexOf(entry));
102 void expectStaticEntry(size_t index) {
103 HpackEntry* entry = decoder_peer_.header_table()->GetByIndex(index);
104 EXPECT_TRUE(entry->IsStatic()) << "index " << index;
107 HpackDecoder decoder_;
108 test::HpackDecoderPeer decoder_peer_;
111 TEST_F(HpackDecoderTest, HandleControlFrameHeadersData) {
112 // Strings under threshold are concatenated in the buffer.
113 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(
114 0, "small string one", 16));
115 EXPECT_TRUE(decoder_.HandleControlFrameHeadersData(
116 0, "small string two", 16));
117 // A string which would push the buffer over the threshold is refused.
118 EXPECT_FALSE(decoder_.HandleControlFrameHeadersData(
119 0, "fails", kMaxDecodeBufferSize - 32 + 1));
121 EXPECT_EQ(decoder_peer_.headers_block_buffer(),
122 "small string onesmall string two");
125 TEST_F(HpackDecoderTest, HandleControlFrameHeadersComplete) {
126 // Decode a block which toggles two static headers into the reference set.
127 EXPECT_TRUE(DecodeHeaderBlock("\x82\x86"));
129 decoder_peer_.set_cookie_value("foobar=baz");
131 // Headers in the reference set should be emitted.
132 // Incremental cookie buffer should be emitted and cleared.
133 decoder_.HandleControlFrameHeadersData(0, NULL, 0);
134 decoder_.HandleControlFrameHeadersComplete(0);
136 EXPECT_THAT(decoded_block(), ElementsAre(
137 Pair(":method", "GET"),
138 Pair(":path", "/index.html"),
139 Pair("cookie", "foobar=baz")));
140 EXPECT_EQ(decoder_peer_.cookie_value(), "");
143 TEST_F(HpackDecoderTest, HandleHeaderRepresentation) {
144 // All cookie crumbs are joined.
145 decoder_peer_.HandleHeaderRepresentation("cookie", " part 1");
146 decoder_peer_.HandleHeaderRepresentation("cookie", "part 2 ");
147 decoder_peer_.HandleHeaderRepresentation("cookie", "part3");
149 // Already-delimited headers are passed through.
150 decoder_peer_.HandleHeaderRepresentation("passed-through",
151 string("foo\0baz", 7));
153 // Other headers are joined on \0. Case matters.
154 decoder_peer_.HandleHeaderRepresentation("joined", "not joined");
155 decoder_peer_.HandleHeaderRepresentation("joineD", "value 1");
156 decoder_peer_.HandleHeaderRepresentation("joineD", "value 2");
158 // Empty headers remain empty.
159 decoder_peer_.HandleHeaderRepresentation("empty", "");
161 // Joined empty headers work as expected.
162 decoder_peer_.HandleHeaderRepresentation("empty-joined", "");
163 decoder_peer_.HandleHeaderRepresentation("empty-joined", "foo");
164 decoder_peer_.HandleHeaderRepresentation("empty-joined", "");
165 decoder_peer_.HandleHeaderRepresentation("empty-joined", "");
167 // Non-contiguous cookie crumb.
168 decoder_peer_.HandleHeaderRepresentation("cookie", " fin!");
170 // Finish and emit all headers.
171 decoder_.HandleControlFrameHeadersComplete(0);
173 EXPECT_THAT(decoded_block(), ElementsAre(
174 Pair("cookie", " part 1; part 2 ; part3; fin!"),
176 Pair("empty-joined", string("\0foo\0\0", 6)),
177 Pair("joineD", string("value 1\0value 2", 15)),
178 Pair("joined", "not joined"),
179 Pair("passed-through", string("foo\0baz", 7))));
182 // Decoding an encoded name with a valid string literal should work.
183 TEST_F(HpackDecoderTest, DecodeNextNameLiteral) {
184 HpackInputStream input_stream(kLiteralBound, StringPiece("\x00\x04name", 6));
186 StringPiece string_piece;
187 EXPECT_TRUE(decoder_peer_.DecodeNextName(&input_stream, &string_piece));
188 EXPECT_EQ("name", string_piece);
189 EXPECT_FALSE(input_stream.HasMoreData());
192 TEST_F(HpackDecoderTest, DecodeNextNameLiteralWithHuffmanEncoding) {
193 string input = a2b_hex("008825a849e95ba97d7f");
194 HpackInputStream input_stream(kLiteralBound, input);
196 StringPiece string_piece;
197 EXPECT_TRUE(decoder_peer_.DecodeNextName(&input_stream, &string_piece));
198 EXPECT_EQ("custom-key", string_piece);
199 EXPECT_FALSE(input_stream.HasMoreData());
202 // Decoding an encoded name with a valid index should work.
203 TEST_F(HpackDecoderTest, DecodeNextNameIndexed) {
204 HpackInputStream input_stream(kLiteralBound, "\x01");
206 StringPiece string_piece;
207 EXPECT_TRUE(decoder_peer_.DecodeNextName(&input_stream, &string_piece));
208 EXPECT_EQ(":authority", string_piece);
209 EXPECT_FALSE(input_stream.HasMoreData());
212 // Decoding an encoded name with an invalid index should fail.
213 TEST_F(HpackDecoderTest, DecodeNextNameInvalidIndex) {
214 // One more than the number of static table entries.
215 HpackInputStream input_stream(kLiteralBound, "\x3e");
217 StringPiece string_piece;
218 EXPECT_FALSE(decoder_peer_.DecodeNextName(&input_stream, &string_piece));
221 // Decoding an indexed header should toggle the index's presence in
222 // the reference set, making a copy of static table entries if
223 // necessary. It should also emit the header if toggled on (and only
224 // as many times as it was toggled on).
225 TEST_F(HpackDecoderTest, IndexedHeaderBasic) {
226 // Toggle on static table entry #2 (and make a copy at index #1),
227 // then toggle on static table entry #5 (which is now #6 because of
229 std::map<string, string> header_set1 =
230 DecodeBlockExpectingSuccess("\x82\x86");
231 std::map<string, string> expected_header_set1;
232 expected_header_set1[":method"] = "GET";
233 expected_header_set1[":path"] = "/index.html";
234 EXPECT_EQ(expected_header_set1, header_set1);
236 std::map<string, string> expected_header_set2;
237 expected_header_set2[":path"] = "/index.html";
238 // Toggle off the copy of static table entry #5.
239 std::map<string, string> header_set2 =
240 DecodeBlockExpectingSuccess("\x82");
241 EXPECT_EQ(expected_header_set2, header_set2);
244 // Test a too-large indexed header.
245 TEST_F(HpackDecoderTest, InvalidIndexedHeader) {
246 // High-bit set, and a prefix of one more than the number of static entries.
247 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1)));
250 TEST_F(HpackDecoderTest, ContextUpdateMaximumSize) {
251 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
252 decoder_peer_.header_table()->max_size());
255 // Maximum-size update with size 126. Succeeds.
256 HpackOutputStream output_stream;
257 output_stream.AppendPrefix(kEncodingContextOpcode);
258 output_stream.AppendPrefix(kEncodingContextNewMaximumSize);
259 output_stream.AppendUint32(126);
261 output_stream.TakeString(&input);
262 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input)));
263 EXPECT_EQ(126u, decoder_peer_.header_table()->max_size());
266 // Maximum-size update with kDefaultHeaderTableSizeSetting. Succeeds.
267 HpackOutputStream output_stream;
268 output_stream.AppendPrefix(kEncodingContextOpcode);
269 output_stream.AppendPrefix(kEncodingContextNewMaximumSize);
270 output_stream.AppendUint32(kDefaultHeaderTableSizeSetting);
272 output_stream.TakeString(&input);
273 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input)));
274 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
275 decoder_peer_.header_table()->max_size());
278 // Maximum-size update with kDefaultHeaderTableSizeSetting + 1. Fails.
279 HpackOutputStream output_stream;
280 output_stream.AppendPrefix(kEncodingContextOpcode);
281 output_stream.AppendPrefix(kEncodingContextNewMaximumSize);
282 output_stream.AppendUint32(kDefaultHeaderTableSizeSetting + 1);
284 output_stream.TakeString(&input);
285 EXPECT_FALSE(DecodeHeaderBlock(StringPiece(input)));
286 EXPECT_EQ(kDefaultHeaderTableSizeSetting,
287 decoder_peer_.header_table()->max_size());
291 TEST_F(HpackDecoderTest, ContextUpdateClearReferenceSet) {
292 // Toggle on a couple of headers.
293 std::map<string, string> header_set1 =
294 DecodeBlockExpectingSuccess("\x82\x86");
295 std::map<string, string> expected_header_set1;
296 expected_header_set1[":method"] = "GET";
297 expected_header_set1[":path"] = "/index.html";
298 EXPECT_EQ(expected_header_set1, header_set1);
300 // Send a context update to clear the reference set.
301 std::map<string, string> header_set2 =
302 DecodeBlockExpectingSuccess("\x30");
303 std::map<string, string> expected_header_set2;
304 EXPECT_EQ(expected_header_set2, header_set2);
307 // Decoding two valid encoded literal headers with no indexing should
309 TEST_F(HpackDecoderTest, LiteralHeaderNoIndexing) {
310 // First header with indexed name, second header with string literal
312 const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2";
313 std::map<string, string> header_set =
314 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1));
316 std::map<string, string> expected_header_set;
317 expected_header_set[":path"] = "/sample/path";
318 expected_header_set[":path2"] = "/sample/path/2";
319 EXPECT_EQ(expected_header_set, header_set);
322 // Decoding two valid encoded literal headers with incremental
323 // indexing and string literal names should work and add the headers
324 // to the reference set.
325 TEST_F(HpackDecoderTest, LiteralHeaderIncrementalIndexing) {
326 const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2";
327 std::map<string, string> header_set =
328 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1));
330 std::map<string, string> expected_header_set;
331 expected_header_set[":path"] = "/sample/path";
332 expected_header_set[":path2"] = "/sample/path/2";
333 EXPECT_EQ(expected_header_set, header_set);
335 // Decoding an empty string should just return the reference set.
336 std::map<string, string> header_set2 = DecodeBlockExpectingSuccess("");
337 EXPECT_EQ(expected_header_set, header_set2);
340 TEST_F(HpackDecoderTest, LiteralHeaderWithIndexingInvalidNameIndex) {
341 decoder_.ApplyHeaderTableSizeSetting(0);
343 // Name is the last static index. Works.
344 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x7d\x03ooo")));
345 // Name is one beyond the last static index. Fails.
346 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x7e\x03ooo")));
349 TEST_F(HpackDecoderTest, LiteralHeaderNoIndexingInvalidNameIndex) {
350 // Name is the last static index. Works.
351 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x0f\x2e\x03ooo")));
352 // Name is one beyond the last static index. Fails.
353 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x0f\x2f\x03ooo")));
356 TEST_F(HpackDecoderTest, LiteralHeaderNeverIndexedInvalidNameIndex) {
357 // Name is the last static index. Works.
358 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x1f\x2e\x03ooo")));
359 // Name is one beyond the last static index. Fails.
360 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x1f\x2f\x03ooo")));
363 // Round-tripping the header set from E.2.1 should work.
364 TEST_F(HpackDecoderTest, BasicE21) {
365 HpackEncoder encoder(ObtainHpackHuffmanTable());
367 std::map<string, string> expected_header_set;
368 expected_header_set[":method"] = "GET";
369 expected_header_set[":scheme"] = "http";
370 expected_header_set[":path"] = "/";
371 expected_header_set[":authority"] = "www.example.com";
373 string encoded_header_set;
374 EXPECT_TRUE(encoder.EncodeHeaderSet(
375 expected_header_set, &encoded_header_set));
377 EXPECT_TRUE(DecodeHeaderBlock(encoded_header_set));
378 EXPECT_EQ(expected_header_set, decoded_block());
381 TEST_F(HpackDecoderTest, SectionD3RequestHuffmanExamples) {
382 std::map<string, string> header_set;
384 // 82 | == Indexed - Add ==
387 // 87 | == Indexed - Add ==
389 // | -> :scheme: http
390 // 86 | == Indexed - Add ==
393 // 44 | == Literal indexed ==
394 // | Indexed name (idx = 4)
396 // 8c | Literal value (len = 15)
397 // | Huffman encoded:
398 // f1e3 c2e5 f23a 6ba0 ab90 f4ff | .....:k.....
401 // | -> :authority: www.example.com
402 string first = a2b_hex("828786448cf1e3c2e5f23a6ba0ab90f4"
404 header_set = DecodeBlockExpectingSuccess(first);
406 EXPECT_THAT(header_set, ElementsAre(
407 Pair(":authority", "www.example.com"),
408 Pair(":method", "GET"),
410 Pair(":scheme", "http")));
412 expectEntry(1, 57, ":authority", "www.example.com");
413 expectEntry(2, 38, ":path", "/");
414 expectEntry(3, 43, ":scheme", "http");
415 expectEntry(4, 42, ":method", "GET");
416 expectStaticEntry(5);
417 EXPECT_EQ(180u, decoder_peer_.header_table()->size());
419 // 5c | == Literal indexed ==
420 // | Indexed name (idx = 28)
422 // 86 | Literal value (len = 8)
423 // | Huffman encoded:
424 // a8eb 1064 9cbf | ...d..
427 // | -> cache-control: no-cache
428 string second = a2b_hex("5c86a8eb10649cbf");
429 header_set = DecodeBlockExpectingSuccess(second);
431 EXPECT_THAT(header_set, ElementsAre(
432 Pair(":authority", "www.example.com"),
433 Pair(":method", "GET"),
435 Pair(":scheme", "http"),
436 Pair("cache-control", "no-cache")));
438 expectEntry(1, 53, "cache-control", "no-cache");
439 expectEntry(2, 57, ":authority", "www.example.com");
440 expectEntry(3, 38, ":path", "/");
441 expectEntry(4, 43, ":scheme", "http");
442 expectEntry(5, 42, ":method", "GET");
443 expectStaticEntry(6);
444 EXPECT_EQ(233u, decoder_peer_.header_table()->size());
446 // 30 | == Empty reference set ==
449 // 85 | == Indexed - Add ==
452 // 8c | == Indexed - Add ==
454 // | -> :scheme: https
455 // 8b | == Indexed - Add ==
457 // | -> :path: /index.html
458 // 84 | == Indexed - Add ==
460 // | -> :authority: www.example.com
461 // 40 | == Literal indexed ==
462 // 88 | Literal name (len = 10)
463 // | Huffman encoded:
464 // 25a8 49e9 5ba9 7d7f | %.I.[.}.
467 // 89 | Literal value (len = 12)
468 // | Huffman encoded:
469 // 25a8 49e9 5bb8 e8b4 bf | %.I.[....
472 // | -> custom-key: custom-value
473 string third = a2b_hex("30858c8b84408825a849e95ba97d7f89"
474 "25a849e95bb8e8b4bf");
475 header_set = DecodeBlockExpectingSuccess(third);
477 EXPECT_THAT(header_set, ElementsAre(
478 Pair(":authority", "www.example.com"),
479 Pair(":method", "GET"),
480 Pair(":path", "/index.html"),
481 Pair(":scheme", "https"),
482 Pair("custom-key", "custom-value")));
484 expectEntry(1, 54, "custom-key", "custom-value");
485 expectEntry(2, 48, ":path", "/index.html");
486 expectEntry(3, 44, ":scheme", "https");
487 expectEntry(4, 53, "cache-control", "no-cache");
488 expectEntry(5, 57, ":authority", "www.example.com");
489 expectEntry(6, 38, ":path", "/");
490 expectEntry(7, 43, ":scheme", "http");
491 expectEntry(8, 42, ":method", "GET");
492 expectStaticEntry(9);
493 EXPECT_EQ(379u, decoder_peer_.header_table()->size());
496 TEST_F(HpackDecoderTest, SectionD5ResponseHuffmanExamples) {
497 std::map<string, string> header_set;
498 decoder_.ApplyHeaderTableSizeSetting(256);
500 // 48 | == Literal indexed ==
501 // | Indexed name (idx = 8)
503 // 82 | Literal value (len = 3)
504 // | Huffman encoded:
509 // 59 | == Literal indexed ==
510 // | Indexed name (idx = 25)
512 // 85 | Literal value (len = 7)
513 // | Huffman encoded:
514 // aec3 771a 4b | ..w.K
517 // | -> cache-control: private
518 // 63 | == Literal indexed ==
519 // | Indexed name (idx = 35)
521 // 96 | Literal value (len = 29)
522 // | Huffman encoded:
523 // d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
524 // e082 a62d 1bff | ...-..
526 // | Mon, 21 Oct 2013 20:13:21
528 // | -> date: Mon, 21 Oct 2013
530 // 71 | == Literal indexed ==
531 // | Indexed name (idx = 49)
533 // 91 | Literal value (len = 23)
534 // | Huffman encoded:
535 // 9d29 ad17 1863 c78f 0b97 c8e9 ae82 ae43 | .)...c.........C
538 // | https://www.example.com
539 // | -> location: https://www.e
541 string first = a2b_hex("488264025985aec3771a4b6396d07abe"
542 "941054d444a8200595040b8166e082a6"
543 "2d1bff71919d29ad171863c78f0b97c8"
545 header_set = DecodeBlockExpectingSuccess(first);
547 EXPECT_THAT(header_set, ElementsAre(
548 Pair(":status", "302"),
549 Pair("cache-control", "private"),
550 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
551 Pair("location", "https://www.example.com")));
553 expectEntry(1, 63, "location", "https://www.example.com");
554 expectEntry(2, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT");
555 expectEntry(3, 52, "cache-control", "private");
556 expectEntry(4, 42, ":status", "302");
557 expectStaticEntry(5);
558 EXPECT_EQ(222u, decoder_peer_.header_table()->size());
560 // 8c | == Indexed - Add ==
562 // | - evict: :status: 302
564 string second = a2b_hex("8c");
565 header_set = DecodeBlockExpectingSuccess(second);
567 EXPECT_THAT(header_set, ElementsAre(
568 Pair(":status", "200"),
569 Pair("cache-control", "private"),
570 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
571 Pair("location", "https://www.example.com")));
573 expectEntry(1, 42, ":status", "200");
574 expectEntry(2, 63, "location", "https://www.example.com");
575 expectEntry(3, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT");
576 expectEntry(4, 52, "cache-control", "private");
577 expectStaticEntry(5);
578 EXPECT_EQ(222u, decoder_peer_.header_table()->size());
580 // 84 | == Indexed - Remove ==
582 // | -> cache-control: private
583 // 84 | == Indexed - Add ==
585 // | -> cache-control: private
586 // 43 | == Literal indexed ==
587 // | Indexed name (idx = 3)
589 // 96 | Literal value (len = 29)
590 // | Huffman encoded:
591 // d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
592 // e084 a62d 1bff | ...-..
594 // | Mon, 21 Oct 2013 20:13:22
596 // | - evict: cache-control: pr
598 // | -> date: Mon, 21 Oct 2013
600 // 5e | == Literal indexed ==
601 // | Indexed name (idx = 30)
602 // | content-encoding
603 // 83 | Literal value (len = 4)
604 // | Huffman encoded:
608 // | - evict: date: Mon, 21 Oct
609 // | 2013 20:13:21 GMT
610 // | -> content-encoding: gzip
611 // 84 | == Indexed - Remove ==
613 // | -> location: https://www.e
615 // 84 | == Indexed - Add ==
617 // | -> location: https://www.e
619 // 83 | == Indexed - Remove ==
622 // 83 | == Indexed - Add ==
625 // 7b | == Literal indexed ==
626 // | Indexed name (idx = 59)
628 // ad | Literal value (len = 56)
629 // | Huffman encoded:
630 // 94e7 821d d7f2 e6c7 b335 dfdf cd5b 3960 | .........5...[9`
631 // d5af 2708 7f36 72c1 ab27 0fb5 291f 9587 | ..'..6r..'..)...
632 // 3160 65c0 03ed 4ee5 b106 3d50 07 | 1`e...N...=P.
634 // | foo=ASDJKHQKBZXOQWEOPIUAXQ
635 // | WEOIU; max-age=3600; versi
637 // | - evict: location: https:/
638 // | /www.example.com
639 // | - evict: :status: 200
640 // | -> set-cookie: foo=ASDJKHQ
641 // | KBZXOQWEOPIUAXQWEOIU; ma
642 // | x-age=3600; version=1
643 string third = a2b_hex("84844396d07abe941054d444a8200595"
644 "040b8166e084a62d1bff5e839bd9ab84"
645 "8483837bad94e7821dd7f2e6c7b335df"
646 "dfcd5b3960d5af27087f3672c1ab270f"
647 "b5291f9587316065c003ed4ee5b1063d"
649 header_set = DecodeBlockExpectingSuccess(third);
651 EXPECT_THAT(header_set, ElementsAre(
652 Pair(":status", "200"),
653 Pair("cache-control", "private"),
654 Pair("content-encoding", "gzip"),
655 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
656 Pair("location", "https://www.example.com"),
657 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
658 " max-age=3600; version=1")));
660 expectEntry(1, 98, "set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
661 " max-age=3600; version=1");
662 expectEntry(2, 52, "content-encoding", "gzip");
663 expectEntry(3, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT");
664 expectStaticEntry(4);
665 EXPECT_EQ(215u, decoder_peer_.header_table()->size());