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 HpackDecoder decoder_
;
103 test::HpackDecoderPeer decoder_peer_
;
106 TEST_F(HpackDecoderTest
, HandleControlFrameHeadersData
) {
107 // Strings under threshold are concatenated in the buffer.
108 EXPECT_TRUE(decoder_
.HandleControlFrameHeadersData(
109 0, "small string one", 16));
110 EXPECT_TRUE(decoder_
.HandleControlFrameHeadersData(
111 0, "small string two", 16));
112 // A string which would push the buffer over the threshold is refused.
113 EXPECT_FALSE(decoder_
.HandleControlFrameHeadersData(
114 0, "fails", kMaxDecodeBufferSize
- 32 + 1));
116 EXPECT_EQ(decoder_peer_
.headers_block_buffer(),
117 "small string onesmall string two");
120 TEST_F(HpackDecoderTest
, HandleControlFrameHeadersComplete
) {
121 decoder_peer_
.set_cookie_value("foobar=baz");
123 // Incremental cookie buffer should be emitted and cleared.
124 decoder_
.HandleControlFrameHeadersData(0, "\x82\x85", 2);
125 decoder_
.HandleControlFrameHeadersComplete(0);
127 EXPECT_THAT(decoded_block(), ElementsAre(
128 Pair(":method", "GET"),
129 Pair(":path", "/index.html"),
130 Pair("cookie", "foobar=baz")));
131 EXPECT_EQ(decoder_peer_
.cookie_value(), "");
134 TEST_F(HpackDecoderTest
, HandleHeaderRepresentation
) {
135 // All cookie crumbs are joined.
136 decoder_peer_
.HandleHeaderRepresentation("cookie", " part 1");
137 decoder_peer_
.HandleHeaderRepresentation("cookie", "part 2 ");
138 decoder_peer_
.HandleHeaderRepresentation("cookie", "part3");
140 // Already-delimited headers are passed through.
141 decoder_peer_
.HandleHeaderRepresentation("passed-through",
142 string("foo\0baz", 7));
144 // Other headers are joined on \0. Case matters.
145 decoder_peer_
.HandleHeaderRepresentation("joined", "not joined");
146 decoder_peer_
.HandleHeaderRepresentation("joineD", "value 1");
147 decoder_peer_
.HandleHeaderRepresentation("joineD", "value 2");
149 // Empty headers remain empty.
150 decoder_peer_
.HandleHeaderRepresentation("empty", "");
152 // Joined empty headers work as expected.
153 decoder_peer_
.HandleHeaderRepresentation("empty-joined", "");
154 decoder_peer_
.HandleHeaderRepresentation("empty-joined", "foo");
155 decoder_peer_
.HandleHeaderRepresentation("empty-joined", "");
156 decoder_peer_
.HandleHeaderRepresentation("empty-joined", "");
158 // Non-contiguous cookie crumb.
159 decoder_peer_
.HandleHeaderRepresentation("cookie", " fin!");
161 // Finish and emit all headers.
162 decoder_
.HandleControlFrameHeadersComplete(0);
164 EXPECT_THAT(decoded_block(), ElementsAre(
165 Pair("cookie", " part 1; part 2 ; part3; fin!"),
167 Pair("empty-joined", string("\0foo\0\0", 6)),
168 Pair("joineD", string("value 1\0value 2", 15)),
169 Pair("joined", "not joined"),
170 Pair("passed-through", string("foo\0baz", 7))));
173 // Decoding an encoded name with a valid string literal should work.
174 TEST_F(HpackDecoderTest
, DecodeNextNameLiteral
) {
175 HpackInputStream
input_stream(kLiteralBound
, StringPiece("\x00\x04name", 6));
177 StringPiece string_piece
;
178 EXPECT_TRUE(decoder_peer_
.DecodeNextName(&input_stream
, &string_piece
));
179 EXPECT_EQ("name", string_piece
);
180 EXPECT_FALSE(input_stream
.HasMoreData());
183 TEST_F(HpackDecoderTest
, DecodeNextNameLiteralWithHuffmanEncoding
) {
184 string input
= a2b_hex("008825a849e95ba97d7f");
185 HpackInputStream
input_stream(kLiteralBound
, input
);
187 StringPiece string_piece
;
188 EXPECT_TRUE(decoder_peer_
.DecodeNextName(&input_stream
, &string_piece
));
189 EXPECT_EQ("custom-key", string_piece
);
190 EXPECT_FALSE(input_stream
.HasMoreData());
193 // Decoding an encoded name with a valid index should work.
194 TEST_F(HpackDecoderTest
, DecodeNextNameIndexed
) {
195 HpackInputStream
input_stream(kLiteralBound
, "\x01");
197 StringPiece string_piece
;
198 EXPECT_TRUE(decoder_peer_
.DecodeNextName(&input_stream
, &string_piece
));
199 EXPECT_EQ(":authority", string_piece
);
200 EXPECT_FALSE(input_stream
.HasMoreData());
203 // Decoding an encoded name with an invalid index should fail.
204 TEST_F(HpackDecoderTest
, DecodeNextNameInvalidIndex
) {
205 // One more than the number of static table entries.
206 HpackInputStream
input_stream(kLiteralBound
, "\x3e");
208 StringPiece string_piece
;
209 EXPECT_FALSE(decoder_peer_
.DecodeNextName(&input_stream
, &string_piece
));
212 // Decoding indexed static table field should work.
213 TEST_F(HpackDecoderTest
, IndexedHeaderStatic
) {
214 // Reference static table entries #2 and #5.
215 std::map
<string
, string
> header_set1
=
216 DecodeBlockExpectingSuccess("\x82\x85");
217 std::map
<string
, string
> expected_header_set1
;
218 expected_header_set1
[":method"] = "GET";
219 expected_header_set1
[":path"] = "/index.html";
220 EXPECT_EQ(expected_header_set1
, header_set1
);
222 // Reference static table entry #2.
223 std::map
<string
, string
> header_set2
=
224 DecodeBlockExpectingSuccess("\x82");
225 std::map
<string
, string
> expected_header_set2
;
226 expected_header_set2
[":method"] = "GET";
227 EXPECT_EQ(expected_header_set2
, header_set2
);
230 TEST_F(HpackDecoderTest
, IndexedHeaderDynamic
) {
231 // First header block: add an entry to header table.
232 std::map
<string
, string
> header_set1
=
233 DecodeBlockExpectingSuccess("\x40\x03" "foo" "\x03" "bar");
234 std::map
<string
, string
> expected_header_set1
;
235 expected_header_set1
["foo"] = "bar";
236 EXPECT_EQ(expected_header_set1
, header_set1
);
238 // Second header block: add another entry to header table.
239 std::map
<string
, string
> header_set2
=
240 DecodeBlockExpectingSuccess("\xbe\x40\x04" "spam" "\x04" "eggs");
241 std::map
<string
, string
> expected_header_set2
;
242 expected_header_set2
["foo"] = "bar";
243 expected_header_set2
["spam"] = "eggs";
244 EXPECT_EQ(expected_header_set2
, header_set2
);
246 // Third header block: refer to most recently added entry.
247 std::map
<string
, string
> header_set3
=
248 DecodeBlockExpectingSuccess("\xbe");
249 std::map
<string
, string
> expected_header_set3
;
250 expected_header_set3
["spam"] = "eggs";
251 EXPECT_EQ(expected_header_set3
, header_set3
);
254 // Test a too-large indexed header.
255 TEST_F(HpackDecoderTest
, InvalidIndexedHeader
) {
256 // High-bit set, and a prefix of one more than the number of static entries.
257 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1)));
260 TEST_F(HpackDecoderTest
, ContextUpdateMaximumSize
) {
261 EXPECT_EQ(kDefaultHeaderTableSizeSetting
,
262 decoder_peer_
.header_table()->max_size());
265 // Maximum-size update with size 126. Succeeds.
266 HpackOutputStream output_stream
;
267 output_stream
.AppendPrefix(kHeaderTableSizeUpdateOpcode
);
268 output_stream
.AppendUint32(126);
270 output_stream
.TakeString(&input
);
271 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input
)));
272 EXPECT_EQ(126u, decoder_peer_
.header_table()->max_size());
275 // Maximum-size update with kDefaultHeaderTableSizeSetting. Succeeds.
276 HpackOutputStream output_stream
;
277 output_stream
.AppendPrefix(kHeaderTableSizeUpdateOpcode
);
278 output_stream
.AppendUint32(kDefaultHeaderTableSizeSetting
);
280 output_stream
.TakeString(&input
);
281 EXPECT_TRUE(DecodeHeaderBlock(StringPiece(input
)));
282 EXPECT_EQ(kDefaultHeaderTableSizeSetting
,
283 decoder_peer_
.header_table()->max_size());
286 // Maximum-size update with kDefaultHeaderTableSizeSetting + 1. Fails.
287 HpackOutputStream output_stream
;
288 output_stream
.AppendPrefix(kHeaderTableSizeUpdateOpcode
);
289 output_stream
.AppendUint32(kDefaultHeaderTableSizeSetting
+ 1);
291 output_stream
.TakeString(&input
);
292 EXPECT_FALSE(DecodeHeaderBlock(StringPiece(input
)));
293 EXPECT_EQ(kDefaultHeaderTableSizeSetting
,
294 decoder_peer_
.header_table()->max_size());
298 // Decoding two valid encoded literal headers with no indexing should
300 TEST_F(HpackDecoderTest
, LiteralHeaderNoIndexing
) {
301 // First header with indexed name, second header with string literal
303 const char input
[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2";
304 std::map
<string
, string
> header_set
=
305 DecodeBlockExpectingSuccess(StringPiece(input
, arraysize(input
) - 1));
307 std::map
<string
, string
> expected_header_set
;
308 expected_header_set
[":path"] = "/sample/path";
309 expected_header_set
[":path2"] = "/sample/path/2";
310 EXPECT_EQ(expected_header_set
, header_set
);
313 // Decoding two valid encoded literal headers with incremental
314 // indexing and string literal names should work.
315 TEST_F(HpackDecoderTest
, LiteralHeaderIncrementalIndexing
) {
316 const char input
[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2";
317 std::map
<string
, string
> header_set
=
318 DecodeBlockExpectingSuccess(StringPiece(input
, arraysize(input
) - 1));
320 std::map
<string
, string
> expected_header_set
;
321 expected_header_set
[":path"] = "/sample/path";
322 expected_header_set
[":path2"] = "/sample/path/2";
323 EXPECT_EQ(expected_header_set
, header_set
);
326 TEST_F(HpackDecoderTest
, LiteralHeaderWithIndexingInvalidNameIndex
) {
327 decoder_
.ApplyHeaderTableSizeSetting(0);
329 // Name is the last static index. Works.
330 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x7d\x03ooo")));
331 // Name is one beyond the last static index. Fails.
332 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x7e\x03ooo")));
335 TEST_F(HpackDecoderTest
, LiteralHeaderNoIndexingInvalidNameIndex
) {
336 // Name is the last static index. Works.
337 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x0f\x2e\x03ooo")));
338 // Name is one beyond the last static index. Fails.
339 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x0f\x2f\x03ooo")));
342 TEST_F(HpackDecoderTest
, LiteralHeaderNeverIndexedInvalidNameIndex
) {
343 // Name is the last static index. Works.
344 EXPECT_TRUE(DecodeHeaderBlock(StringPiece("\x1f\x2e\x03ooo")));
345 // Name is one beyond the last static index. Fails.
346 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\x1f\x2f\x03ooo")));
349 // Round-tripping the header set from E.2.1 should work.
350 TEST_F(HpackDecoderTest
, BasicE21
) {
351 HpackEncoder
encoder(ObtainHpackHuffmanTable());
353 std::map
<string
, string
> expected_header_set
;
354 expected_header_set
[":method"] = "GET";
355 expected_header_set
[":scheme"] = "http";
356 expected_header_set
[":path"] = "/";
357 expected_header_set
[":authority"] = "www.example.com";
359 string encoded_header_set
;
360 EXPECT_TRUE(encoder
.EncodeHeaderSet(
361 expected_header_set
, &encoded_header_set
));
363 EXPECT_TRUE(DecodeHeaderBlock(encoded_header_set
));
364 EXPECT_EQ(expected_header_set
, decoded_block());
367 TEST_F(HpackDecoderTest
, SectionD4RequestHuffmanExamples
) {
368 std::map
<string
, string
> header_set
;
370 // 82 | == Indexed - Add ==
373 // 86 | == Indexed - Add ==
375 // | -> :scheme: http
376 // 84 | == Indexed - Add ==
379 // 41 | == Literal indexed ==
380 // | Indexed name (idx = 1)
382 // 8c | Literal value (len = 15)
383 // | Huffman encoded:
384 // f1e3 c2e5 f23a 6ba0 ab90 f4ff | .....:k.....
387 // | -> :authority: www.example.com
388 string first
= a2b_hex("828684418cf1e3c2e5f23a6ba0ab90f4"
390 header_set
= DecodeBlockExpectingSuccess(first
);
392 EXPECT_THAT(header_set
, ElementsAre(
393 Pair(":authority", "www.example.com"),
394 Pair(":method", "GET"),
396 Pair(":scheme", "http")));
398 expectEntry(62, 57, ":authority", "www.example.com");
399 EXPECT_EQ(57u, decoder_peer_
.header_table()->size());
401 // 82 | == Indexed - Add ==
404 // 86 | == Indexed - Add ==
406 // | -> :scheme: http
407 // 84 | == Indexed - Add ==
410 // be | == Indexed - Add ==
412 // | -> :authority: www.example.com
413 // 58 | == Literal indexed ==
414 // | Indexed name (idx = 24)
416 // 86 | Literal value (len = 8)
417 // | Huffman encoded:
418 // a8eb 1064 9cbf | ...d..
421 // | -> cache-control: no-cache
423 string second
= a2b_hex("828684be5886a8eb10649cbf");
424 header_set
= DecodeBlockExpectingSuccess(second
);
426 EXPECT_THAT(header_set
, ElementsAre(
427 Pair(":authority", "www.example.com"),
428 Pair(":method", "GET"),
430 Pair(":scheme", "http"),
431 Pair("cache-control", "no-cache")));
433 expectEntry(62, 53, "cache-control", "no-cache");
434 expectEntry(63, 57, ":authority", "www.example.com");
435 EXPECT_EQ(110u, decoder_peer_
.header_table()->size());
437 // 82 | == Indexed - Add ==
440 // 87 | == Indexed - Add ==
442 // | -> :scheme: https
443 // 85 | == Indexed - Add ==
445 // | -> :path: /index.html
446 // bf | == Indexed - Add ==
448 // | -> :authority: www.example.com
449 // 40 | == Literal indexed ==
450 // 88 | Literal name (len = 10)
451 // | Huffman encoded:
452 // 25a8 49e9 5ba9 7d7f | %.I.[.}.
455 // 89 | Literal value (len = 12)
456 // | Huffman encoded:
457 // 25a8 49e9 5bb8 e8b4 bf | %.I.[....
460 // | -> custom-key: custom-value
461 string third
= a2b_hex("828785bf408825a849e95ba97d7f89"
462 "25a849e95bb8e8b4bf");
463 header_set
= DecodeBlockExpectingSuccess(third
);
465 EXPECT_THAT(header_set
, ElementsAre(
466 Pair(":authority", "www.example.com"),
467 Pair(":method", "GET"),
468 Pair(":path", "/index.html"),
469 Pair(":scheme", "https"),
470 Pair("custom-key", "custom-value")));
472 expectEntry(62, 54, "custom-key", "custom-value");
473 expectEntry(63, 53, "cache-control", "no-cache");
474 expectEntry(64, 57, ":authority", "www.example.com");
475 EXPECT_EQ(164u, decoder_peer_
.header_table()->size());
478 TEST_F(HpackDecoderTest
, SectionD6ResponseHuffmanExamples
) {
479 std::map
<string
, string
> header_set
;
480 decoder_
.ApplyHeaderTableSizeSetting(256);
482 // 48 | == Literal indexed ==
483 // | Indexed name (idx = 8)
485 // 82 | Literal value (len = 3)
486 // | Huffman encoded:
491 // 58 | == Literal indexed ==
492 // | Indexed name (idx = 24)
494 // 85 | Literal value (len = 7)
495 // | Huffman encoded:
496 // aec3 771a 4b | ..w.K
499 // | -> cache-control: private
500 // 61 | == Literal indexed ==
501 // | Indexed name (idx = 33)
503 // 96 | Literal value (len = 29)
504 // | Huffman encoded:
505 // d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
506 // e082 a62d 1bff | ...-..
508 // | Mon, 21 Oct 2013 20:13:21
510 // | -> date: Mon, 21 Oct 2013
512 // 6e | == Literal indexed ==
513 // | Indexed name (idx = 46)
515 // 91 | Literal value (len = 23)
516 // | Huffman encoded:
517 // 9d29 ad17 1863 c78f 0b97 c8e9 ae82 ae43 | .)...c.........C
520 // | https://www.example.com
521 // | -> location: https://www.e
524 string first
= a2b_hex("488264025885aec3771a4b6196d07abe"
525 "941054d444a8200595040b8166e082a6"
526 "2d1bff6e919d29ad171863c78f0b97c8"
528 header_set
= DecodeBlockExpectingSuccess(first
);
530 EXPECT_THAT(header_set
, ElementsAre(
531 Pair(":status", "302"),
532 Pair("cache-control", "private"),
533 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
534 Pair("location", "https://www.example.com")));
536 expectEntry(62, 63, "location", "https://www.example.com");
537 expectEntry(63, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT");
538 expectEntry(64, 52, "cache-control", "private");
539 expectEntry(65, 42, ":status", "302");
540 EXPECT_EQ(222u, decoder_peer_
.header_table()->size());
542 // 48 | == Literal indexed ==
543 // | Indexed name (idx = 8)
545 // 83 | Literal value (len = 3)
546 // | Huffman encoded:
550 // | - evict: :status: 302
552 // c1 | == Indexed - Add ==
554 // | -> cache-control: private
555 // c0 | == Indexed - Add ==
557 // | -> date: Mon, 21 Oct 2013
559 // bf | == Indexed - Add ==
562 // | https://www.example.com
563 string second
= a2b_hex("4883640effc1c0bf");
564 header_set
= DecodeBlockExpectingSuccess(second
);
566 EXPECT_THAT(header_set
, ElementsAre(
567 Pair(":status", "307"),
568 Pair("cache-control", "private"),
569 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"),
570 Pair("location", "https://www.example.com")));
572 expectEntry(62, 42, ":status", "307");
573 expectEntry(63, 63, "location", "https://www.example.com");
574 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT");
575 expectEntry(65, 52, "cache-control", "private");
576 EXPECT_EQ(222u, decoder_peer_
.header_table()->size());
578 // 88 | == Indexed - Add ==
581 // c1 | == Indexed - Add ==
583 // | -> cache-control: private
584 // 61 | == Literal indexed ==
585 // | Indexed name (idx = 33)
587 // 96 | Literal value (len = 22)
588 // | Huffman encoded:
589 // d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
590 // e084 a62d 1bff | ...-..
592 // | Mon, 21 Oct 2013 20:13:22
594 // | - evict: cache-control:
596 // | -> date: Mon, 21 Oct 2013
598 // c0 | == Indexed - Add ==
601 // | https://www.example.com
602 // 5a | == Literal indexed ==
603 // | Indexed name (idx = 26)
604 // | content-encoding
605 // 83 | Literal value (len = 3)
606 // | Huffman encoded:
610 // | - evict: date: Mon, 21 Oct
611 // | 2013 20:13:21 GMT
612 // | -> content-encoding: gzip
613 // 77 | == Literal indexed ==
614 // | Indexed name (idx = 55)
616 // ad | Literal value (len = 45)
617 // | Huffman encoded:
618 // 94e7 821d d7f2 e6c7 b335 dfdf cd5b 3960 | .........5...[9`
619 // d5af 2708 7f36 72c1 ab27 0fb5 291f 9587 | ..'..6r..'..)...
620 // 3160 65c0 03ed 4ee5 b106 3d50 07 | 1`e...N...=P.
622 // | foo=ASDJKHQKBZXOQWEOPIUAXQ
623 // | WEOIU; max-age=3600; versi
625 // | - evict: location:
626 // | https://www.example.com
627 // | - evict: :status: 307
628 // | -> set-cookie: foo=ASDJKHQ
629 // | KBZXOQWEOPIUAXQWEOIU;
630 // | max-age=3600; version=1
631 string third
= a2b_hex("88c16196d07abe941054d444a8200595"
632 "040b8166e084a62d1bffc05a839bd9ab"
633 "77ad94e7821dd7f2e6c7b335dfdfcd5b"
634 "3960d5af27087f3672c1ab270fb5291f"
635 "9587316065c003ed4ee5b1063d5007");
636 header_set
= DecodeBlockExpectingSuccess(third
);
638 EXPECT_THAT(header_set
, ElementsAre(
639 Pair(":status", "200"),
640 Pair("cache-control", "private"),
641 Pair("content-encoding", "gzip"),
642 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"),
643 Pair("location", "https://www.example.com"),
644 Pair("set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
645 " max-age=3600; version=1")));
647 expectEntry(62, 98, "set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
648 " max-age=3600; version=1");
649 expectEntry(63, 52, "content-encoding", "gzip");
650 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT");
651 EXPECT_EQ(215u, decoder_peer_
.header_table()->size());