OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/hpack/hpack_decoder.h" | 5 #include "net/spdy/hpack/hpack_decoder.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 StringPiece string_piece; | 303 StringPiece string_piece; |
304 EXPECT_FALSE(decoder_peer_.DecodeNextName(&input_stream, &string_piece)); | 304 EXPECT_FALSE(decoder_peer_.DecodeNextName(&input_stream, &string_piece)); |
305 EXPECT_FALSE(input_stream.NeedMoreData()); | 305 EXPECT_FALSE(input_stream.NeedMoreData()); |
306 input_stream.MarkCurrentPosition(); | 306 input_stream.MarkCurrentPosition(); |
307 EXPECT_EQ(1u, input_stream.ParsedBytes()); | 307 EXPECT_EQ(1u, input_stream.ParsedBytes()); |
308 } | 308 } |
309 | 309 |
310 // Decoding indexed static table field should work. | 310 // Decoding indexed static table field should work. |
311 TEST_P(HpackDecoderTest, IndexedHeaderStatic) { | 311 TEST_P(HpackDecoderTest, IndexedHeaderStatic) { |
312 // Reference static table entries #2 and #5. | 312 // Reference static table entries #2 and #5. |
313 SpdyHeaderBlock header_set1 = DecodeBlockExpectingSuccess("\x82\x85"); | 313 const SpdyHeaderBlock& header_set1 = DecodeBlockExpectingSuccess("\x82\x85"); |
314 SpdyHeaderBlock expected_header_set1; | 314 SpdyHeaderBlock expected_header_set1; |
315 expected_header_set1[":method"] = "GET"; | 315 expected_header_set1[":method"] = "GET"; |
316 expected_header_set1[":path"] = "/index.html"; | 316 expected_header_set1[":path"] = "/index.html"; |
317 EXPECT_EQ(expected_header_set1, header_set1); | 317 EXPECT_EQ(expected_header_set1, header_set1); |
318 | 318 |
319 // Reference static table entry #2. | 319 // Reference static table entry #2. |
320 SpdyHeaderBlock header_set2 = DecodeBlockExpectingSuccess("\x82"); | 320 const SpdyHeaderBlock& header_set2 = DecodeBlockExpectingSuccess("\x82"); |
321 SpdyHeaderBlock expected_header_set2; | 321 SpdyHeaderBlock expected_header_set2; |
322 expected_header_set2[":method"] = "GET"; | 322 expected_header_set2[":method"] = "GET"; |
323 EXPECT_EQ(expected_header_set2, header_set2); | 323 EXPECT_EQ(expected_header_set2, header_set2); |
324 } | 324 } |
325 | 325 |
326 TEST_P(HpackDecoderTest, IndexedHeaderDynamic) { | 326 TEST_P(HpackDecoderTest, IndexedHeaderDynamic) { |
327 // First header block: add an entry to header table. | 327 // First header block: add an entry to header table. |
328 SpdyHeaderBlock header_set1 = DecodeBlockExpectingSuccess( | 328 const SpdyHeaderBlock& header_set1 = DecodeBlockExpectingSuccess( |
329 "\x40\x03" | 329 "\x40\x03" |
330 "foo" | 330 "foo" |
331 "\x03" | 331 "\x03" |
332 "bar"); | 332 "bar"); |
333 SpdyHeaderBlock expected_header_set1; | 333 SpdyHeaderBlock expected_header_set1; |
334 expected_header_set1["foo"] = "bar"; | 334 expected_header_set1["foo"] = "bar"; |
335 EXPECT_EQ(expected_header_set1, header_set1); | 335 EXPECT_EQ(expected_header_set1, header_set1); |
336 | 336 |
337 // Second header block: add another entry to header table. | 337 // Second header block: add another entry to header table. |
338 SpdyHeaderBlock header_set2 = DecodeBlockExpectingSuccess( | 338 const SpdyHeaderBlock& header_set2 = DecodeBlockExpectingSuccess( |
339 "\xbe\x40\x04" | 339 "\xbe\x40\x04" |
340 "spam" | 340 "spam" |
341 "\x04" | 341 "\x04" |
342 "eggs"); | 342 "eggs"); |
343 SpdyHeaderBlock expected_header_set2; | 343 SpdyHeaderBlock expected_header_set2; |
344 expected_header_set2["foo"] = "bar"; | 344 expected_header_set2["foo"] = "bar"; |
345 expected_header_set2["spam"] = "eggs"; | 345 expected_header_set2["spam"] = "eggs"; |
346 EXPECT_EQ(expected_header_set2, header_set2); | 346 EXPECT_EQ(expected_header_set2, header_set2); |
347 | 347 |
348 // Third header block: refer to most recently added entry. | 348 // Third header block: refer to most recently added entry. |
349 SpdyHeaderBlock header_set3 = DecodeBlockExpectingSuccess("\xbe"); | 349 const SpdyHeaderBlock& header_set3 = DecodeBlockExpectingSuccess("\xbe"); |
350 SpdyHeaderBlock expected_header_set3; | 350 SpdyHeaderBlock expected_header_set3; |
351 expected_header_set3["spam"] = "eggs"; | 351 expected_header_set3["spam"] = "eggs"; |
352 EXPECT_EQ(expected_header_set3, header_set3); | 352 EXPECT_EQ(expected_header_set3, header_set3); |
353 } | 353 } |
354 | 354 |
355 // Test a too-large indexed header. | 355 // Test a too-large indexed header. |
356 TEST_P(HpackDecoderTest, InvalidIndexedHeader) { | 356 TEST_P(HpackDecoderTest, InvalidIndexedHeader) { |
357 // High-bit set, and a prefix of one more than the number of static entries. | 357 // High-bit set, and a prefix of one more than the number of static entries. |
358 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1))); | 358 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1))); |
359 } | 359 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 EXPECT_EQ(60u, decoder_peer_.header_table()->max_size()); | 477 EXPECT_EQ(60u, decoder_peer_.header_table()->max_size()); |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 // Decoding two valid encoded literal headers with no indexing should | 481 // Decoding two valid encoded literal headers with no indexing should |
482 // work. | 482 // work. |
483 TEST_P(HpackDecoderTest, LiteralHeaderNoIndexing) { | 483 TEST_P(HpackDecoderTest, LiteralHeaderNoIndexing) { |
484 // First header with indexed name, second header with string literal | 484 // First header with indexed name, second header with string literal |
485 // name. | 485 // name. |
486 const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2"; | 486 const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2"; |
487 SpdyHeaderBlock header_set = | 487 const SpdyHeaderBlock& header_set = |
488 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1)); | 488 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1)); |
489 | 489 |
490 SpdyHeaderBlock expected_header_set; | 490 SpdyHeaderBlock expected_header_set; |
491 expected_header_set[":path"] = "/sample/path"; | 491 expected_header_set[":path"] = "/sample/path"; |
492 expected_header_set[":path2"] = "/sample/path/2"; | 492 expected_header_set[":path2"] = "/sample/path/2"; |
493 EXPECT_EQ(expected_header_set, header_set); | 493 EXPECT_EQ(expected_header_set, header_set); |
494 } | 494 } |
495 | 495 |
496 // Decoding two valid encoded literal headers with incremental | 496 // Decoding two valid encoded literal headers with incremental |
497 // indexing and string literal names should work. | 497 // indexing and string literal names should work. |
498 TEST_P(HpackDecoderTest, LiteralHeaderIncrementalIndexing) { | 498 TEST_P(HpackDecoderTest, LiteralHeaderIncrementalIndexing) { |
499 const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2"; | 499 const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2"; |
500 SpdyHeaderBlock header_set = | 500 const SpdyHeaderBlock& header_set = |
501 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1)); | 501 DecodeBlockExpectingSuccess(StringPiece(input, arraysize(input) - 1)); |
502 | 502 |
503 SpdyHeaderBlock expected_header_set; | 503 SpdyHeaderBlock expected_header_set; |
504 expected_header_set[":path"] = "/sample/path"; | 504 expected_header_set[":path"] = "/sample/path"; |
505 expected_header_set[":path2"] = "/sample/path/2"; | 505 expected_header_set[":path2"] = "/sample/path/2"; |
506 EXPECT_EQ(expected_header_set, header_set); | 506 EXPECT_EQ(expected_header_set, header_set); |
507 } | 507 } |
508 | 508 |
509 TEST_P(HpackDecoderTest, LiteralHeaderWithIndexingInvalidNameIndex) { | 509 TEST_P(HpackDecoderTest, LiteralHeaderWithIndexingInvalidNameIndex) { |
510 decoder_.ApplyHeaderTableSizeSetting(0); | 510 decoder_.ApplyHeaderTableSizeSetting(0); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 565 |
566 string encoded_header_set; | 566 string encoded_header_set; |
567 EXPECT_TRUE( | 567 EXPECT_TRUE( |
568 encoder.EncodeHeaderSet(expected_header_set, &encoded_header_set)); | 568 encoder.EncodeHeaderSet(expected_header_set, &encoded_header_set)); |
569 | 569 |
570 EXPECT_TRUE(DecodeHeaderBlock(encoded_header_set)); | 570 EXPECT_TRUE(DecodeHeaderBlock(encoded_header_set)); |
571 EXPECT_EQ(expected_header_set, decoded_block()); | 571 EXPECT_EQ(expected_header_set, decoded_block()); |
572 } | 572 } |
573 | 573 |
574 TEST_P(HpackDecoderTest, SectionD4RequestHuffmanExamples) { | 574 TEST_P(HpackDecoderTest, SectionD4RequestHuffmanExamples) { |
575 SpdyHeaderBlock header_set; | |
576 | |
577 // 82 | == Indexed - Add == | 575 // 82 | == Indexed - Add == |
578 // | idx = 2 | 576 // | idx = 2 |
579 // | -> :method: GET | 577 // | -> :method: GET |
580 // 86 | == Indexed - Add == | 578 // 86 | == Indexed - Add == |
581 // | idx = 6 | 579 // | idx = 6 |
582 // | -> :scheme: http | 580 // | -> :scheme: http |
583 // 84 | == Indexed - Add == | 581 // 84 | == Indexed - Add == |
584 // | idx = 4 | 582 // | idx = 4 |
585 // | -> :path: / | 583 // | -> :path: / |
586 // 41 | == Literal indexed == | 584 // 41 | == Literal indexed == |
587 // | Indexed name (idx = 1) | 585 // | Indexed name (idx = 1) |
588 // | :authority | 586 // | :authority |
589 // 8c | Literal value (len = 15) | 587 // 8c | Literal value (len = 15) |
590 // | Huffman encoded: | 588 // | Huffman encoded: |
591 // f1e3 c2e5 f23a 6ba0 ab90 f4ff | .....:k..... | 589 // f1e3 c2e5 f23a 6ba0 ab90 f4ff | .....:k..... |
592 // | Decoded: | 590 // | Decoded: |
593 // | www.example.com | 591 // | www.example.com |
594 // | -> :authority: www.example.com | 592 // | -> :authority: www.example.com |
595 string first = a2b_hex( | 593 string first = a2b_hex("828684418cf1e3c2e5f23a6ba0ab90f4ff"); |
596 "828684418cf1e3c2e5f23a6ba0ab90f4" | 594 const SpdyHeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first); |
597 "ff"); | |
598 header_set = DecodeBlockExpectingSuccess(first); | |
599 | 595 |
600 EXPECT_THAT( | 596 EXPECT_THAT( |
601 header_set, | 597 first_header_set, |
602 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "http"), | 598 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "http"), |
603 Pair(":path", "/"), Pair(":authority", "www.example.com"))); | 599 Pair(":path", "/"), Pair(":authority", "www.example.com"))); |
604 | 600 |
605 expectEntry(62, 57, ":authority", "www.example.com"); | 601 expectEntry(62, 57, ":authority", "www.example.com"); |
606 EXPECT_EQ(57u, decoder_peer_.header_table()->size()); | 602 EXPECT_EQ(57u, decoder_peer_.header_table()->size()); |
607 | 603 |
608 // 82 | == Indexed - Add == | 604 // 82 | == Indexed - Add == |
609 // | idx = 2 | 605 // | idx = 2 |
610 // | -> :method: GET | 606 // | -> :method: GET |
611 // 86 | == Indexed - Add == | 607 // 86 | == Indexed - Add == |
612 // | idx = 6 | 608 // | idx = 6 |
613 // | -> :scheme: http | 609 // | -> :scheme: http |
614 // 84 | == Indexed - Add == | 610 // 84 | == Indexed - Add == |
615 // | idx = 4 | 611 // | idx = 4 |
616 // | -> :path: / | 612 // | -> :path: / |
617 // be | == Indexed - Add == | 613 // be | == Indexed - Add == |
618 // | idx = 62 | 614 // | idx = 62 |
619 // | -> :authority: www.example.com | 615 // | -> :authority: www.example.com |
620 // 58 | == Literal indexed == | 616 // 58 | == Literal indexed == |
621 // | Indexed name (idx = 24) | 617 // | Indexed name (idx = 24) |
622 // | cache-control | 618 // | cache-control |
623 // 86 | Literal value (len = 8) | 619 // 86 | Literal value (len = 8) |
624 // | Huffman encoded: | 620 // | Huffman encoded: |
625 // a8eb 1064 9cbf | ...d.. | 621 // a8eb 1064 9cbf | ...d.. |
626 // | Decoded: | 622 // | Decoded: |
627 // | no-cache | 623 // | no-cache |
628 // | -> cache-control: no-cache | 624 // | -> cache-control: no-cache |
629 | 625 |
630 string second = a2b_hex("828684be5886a8eb10649cbf"); | 626 string second = a2b_hex("828684be5886a8eb10649cbf"); |
631 header_set = DecodeBlockExpectingSuccess(second); | 627 const SpdyHeaderBlock& second_header_set = |
| 628 DecodeBlockExpectingSuccess(second); |
632 | 629 |
633 EXPECT_THAT( | 630 EXPECT_THAT( |
634 header_set, | 631 second_header_set, |
635 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "http"), | 632 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "http"), |
636 Pair(":path", "/"), Pair(":authority", "www.example.com"), | 633 Pair(":path", "/"), Pair(":authority", "www.example.com"), |
637 Pair("cache-control", "no-cache"))); | 634 Pair("cache-control", "no-cache"))); |
638 | 635 |
639 expectEntry(62, 53, "cache-control", "no-cache"); | 636 expectEntry(62, 53, "cache-control", "no-cache"); |
640 expectEntry(63, 57, ":authority", "www.example.com"); | 637 expectEntry(63, 57, ":authority", "www.example.com"); |
641 EXPECT_EQ(110u, decoder_peer_.header_table()->size()); | 638 EXPECT_EQ(110u, decoder_peer_.header_table()->size()); |
642 | 639 |
643 // 82 | == Indexed - Add == | 640 // 82 | == Indexed - Add == |
644 // | idx = 2 | 641 // | idx = 2 |
(...skipping 15 matching lines...) Expand all Loading... |
660 // | custom-key | 657 // | custom-key |
661 // 89 | Literal value (len = 12) | 658 // 89 | Literal value (len = 12) |
662 // | Huffman encoded: | 659 // | Huffman encoded: |
663 // 25a8 49e9 5bb8 e8b4 bf | %.I.[.... | 660 // 25a8 49e9 5bb8 e8b4 bf | %.I.[.... |
664 // | Decoded: | 661 // | Decoded: |
665 // | custom-value | 662 // | custom-value |
666 // | -> custom-key: custom-value | 663 // | -> custom-key: custom-value |
667 string third = a2b_hex( | 664 string third = a2b_hex( |
668 "828785bf408825a849e95ba97d7f89" | 665 "828785bf408825a849e95ba97d7f89" |
669 "25a849e95bb8e8b4bf"); | 666 "25a849e95bb8e8b4bf"); |
670 header_set = DecodeBlockExpectingSuccess(third); | 667 const SpdyHeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third); |
671 | 668 |
672 EXPECT_THAT(header_set, | 669 EXPECT_THAT(third_header_set, |
673 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "https"), | 670 ElementsAre(Pair(":method", "GET"), Pair(":scheme", "https"), |
674 Pair(":path", "/index.html"), | 671 Pair(":path", "/index.html"), |
675 Pair(":authority", "www.example.com"), | 672 Pair(":authority", "www.example.com"), |
676 Pair("custom-key", "custom-value"))); | 673 Pair("custom-key", "custom-value"))); |
677 | 674 |
678 expectEntry(62, 54, "custom-key", "custom-value"); | 675 expectEntry(62, 54, "custom-key", "custom-value"); |
679 expectEntry(63, 53, "cache-control", "no-cache"); | 676 expectEntry(63, 53, "cache-control", "no-cache"); |
680 expectEntry(64, 57, ":authority", "www.example.com"); | 677 expectEntry(64, 57, ":authority", "www.example.com"); |
681 EXPECT_EQ(164u, decoder_peer_.header_table()->size()); | 678 EXPECT_EQ(164u, decoder_peer_.header_table()->size()); |
682 } | 679 } |
683 | 680 |
684 TEST_P(HpackDecoderTest, SectionD6ResponseHuffmanExamples) { | 681 TEST_P(HpackDecoderTest, SectionD6ResponseHuffmanExamples) { |
685 SpdyHeaderBlock header_set; | |
686 decoder_.ApplyHeaderTableSizeSetting(256); | 682 decoder_.ApplyHeaderTableSizeSetting(256); |
687 | 683 |
688 // 48 | == Literal indexed == | 684 // 48 | == Literal indexed == |
689 // | Indexed name (idx = 8) | 685 // | Indexed name (idx = 8) |
690 // | :status | 686 // | :status |
691 // 82 | Literal value (len = 3) | 687 // 82 | Literal value (len = 3) |
692 // | Huffman encoded: | 688 // | Huffman encoded: |
693 // 6402 | d. | 689 // 6402 | d. |
694 // | Decoded: | 690 // | Decoded: |
695 // | 302 | 691 // | 302 |
(...skipping 29 matching lines...) Expand all Loading... |
725 // | Decoded: | 721 // | Decoded: |
726 // | https://www.example.com | 722 // | https://www.example.com |
727 // | -> location: https://www.e | 723 // | -> location: https://www.e |
728 // | xample.com | 724 // | xample.com |
729 | 725 |
730 string first = a2b_hex( | 726 string first = a2b_hex( |
731 "488264025885aec3771a4b6196d07abe" | 727 "488264025885aec3771a4b6196d07abe" |
732 "941054d444a8200595040b8166e082a6" | 728 "941054d444a8200595040b8166e082a6" |
733 "2d1bff6e919d29ad171863c78f0b97c8" | 729 "2d1bff6e919d29ad171863c78f0b97c8" |
734 "e9ae82ae43d3"); | 730 "e9ae82ae43d3"); |
735 header_set = DecodeBlockExpectingSuccess(first); | 731 const SpdyHeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first); |
736 | 732 |
737 EXPECT_THAT( | 733 EXPECT_THAT( |
738 header_set, | 734 first_header_set, |
739 ElementsAre(Pair(":status", "302"), Pair("cache-control", "private"), | 735 ElementsAre(Pair(":status", "302"), Pair("cache-control", "private"), |
740 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"), | 736 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"), |
741 Pair("location", "https://www.example.com"))); | 737 Pair("location", "https://www.example.com"))); |
742 | 738 |
743 expectEntry(62, 63, "location", "https://www.example.com"); | 739 expectEntry(62, 63, "location", "https://www.example.com"); |
744 expectEntry(63, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT"); | 740 expectEntry(63, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT"); |
745 expectEntry(64, 52, "cache-control", "private"); | 741 expectEntry(64, 52, "cache-control", "private"); |
746 expectEntry(65, 42, ":status", "302"); | 742 expectEntry(65, 42, ":status", "302"); |
747 EXPECT_EQ(222u, decoder_peer_.header_table()->size()); | 743 EXPECT_EQ(222u, decoder_peer_.header_table()->size()); |
748 | 744 |
(...skipping 12 matching lines...) Expand all Loading... |
761 // | -> cache-control: private | 757 // | -> cache-control: private |
762 // c0 | == Indexed - Add == | 758 // c0 | == Indexed - Add == |
763 // | idx = 64 | 759 // | idx = 64 |
764 // | -> date: Mon, 21 Oct 2013 | 760 // | -> date: Mon, 21 Oct 2013 |
765 // | 20:13:21 GMT | 761 // | 20:13:21 GMT |
766 // bf | == Indexed - Add == | 762 // bf | == Indexed - Add == |
767 // | idx = 63 | 763 // | idx = 63 |
768 // | -> location: | 764 // | -> location: |
769 // | https://www.example.com | 765 // | https://www.example.com |
770 string second = a2b_hex("4883640effc1c0bf"); | 766 string second = a2b_hex("4883640effc1c0bf"); |
771 header_set = DecodeBlockExpectingSuccess(second); | 767 const SpdyHeaderBlock& second_header_set = |
| 768 DecodeBlockExpectingSuccess(second); |
772 | 769 |
773 EXPECT_THAT( | 770 EXPECT_THAT( |
774 header_set, | 771 second_header_set, |
775 ElementsAre(Pair(":status", "307"), Pair("cache-control", "private"), | 772 ElementsAre(Pair(":status", "307"), Pair("cache-control", "private"), |
776 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"), | 773 Pair("date", "Mon, 21 Oct 2013 20:13:21 GMT"), |
777 Pair("location", "https://www.example.com"))); | 774 Pair("location", "https://www.example.com"))); |
778 | 775 |
779 expectEntry(62, 42, ":status", "307"); | 776 expectEntry(62, 42, ":status", "307"); |
780 expectEntry(63, 63, "location", "https://www.example.com"); | 777 expectEntry(63, 63, "location", "https://www.example.com"); |
781 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT"); | 778 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:21 GMT"); |
782 expectEntry(65, 52, "cache-control", "private"); | 779 expectEntry(65, 52, "cache-control", "private"); |
783 EXPECT_EQ(222u, decoder_peer_.header_table()->size()); | 780 EXPECT_EQ(222u, decoder_peer_.header_table()->size()); |
784 | 781 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 // | - evict: :status: 307 | 831 // | - evict: :status: 307 |
835 // | -> set-cookie: foo=ASDJKHQ | 832 // | -> set-cookie: foo=ASDJKHQ |
836 // | KBZXOQWEOPIUAXQWEOIU; | 833 // | KBZXOQWEOPIUAXQWEOIU; |
837 // | max-age=3600; version=1 | 834 // | max-age=3600; version=1 |
838 string third = a2b_hex( | 835 string third = a2b_hex( |
839 "88c16196d07abe941054d444a8200595" | 836 "88c16196d07abe941054d444a8200595" |
840 "040b8166e084a62d1bffc05a839bd9ab" | 837 "040b8166e084a62d1bffc05a839bd9ab" |
841 "77ad94e7821dd7f2e6c7b335dfdfcd5b" | 838 "77ad94e7821dd7f2e6c7b335dfdfcd5b" |
842 "3960d5af27087f3672c1ab270fb5291f" | 839 "3960d5af27087f3672c1ab270fb5291f" |
843 "9587316065c003ed4ee5b1063d5007"); | 840 "9587316065c003ed4ee5b1063d5007"); |
844 header_set = DecodeBlockExpectingSuccess(third); | 841 const SpdyHeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third); |
845 | 842 |
846 EXPECT_THAT( | 843 EXPECT_THAT( |
847 header_set, | 844 third_header_set, |
848 ElementsAre(Pair(":status", "200"), Pair("cache-control", "private"), | 845 ElementsAre(Pair(":status", "200"), Pair("cache-control", "private"), |
849 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"), | 846 Pair("date", "Mon, 21 Oct 2013 20:13:22 GMT"), |
850 Pair("location", "https://www.example.com"), | 847 Pair("location", "https://www.example.com"), |
851 Pair("content-encoding", "gzip"), | 848 Pair("content-encoding", "gzip"), |
852 Pair("set-cookie", | 849 Pair("set-cookie", |
853 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" | 850 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" |
854 " max-age=3600; version=1"))); | 851 " max-age=3600; version=1"))); |
855 | 852 |
856 expectEntry(62, 98, "set-cookie", | 853 expectEntry(62, 98, "set-cookie", |
857 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" | 854 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" |
858 " max-age=3600; version=1"); | 855 " max-age=3600; version=1"); |
859 expectEntry(63, 52, "content-encoding", "gzip"); | 856 expectEntry(63, 52, "content-encoding", "gzip"); |
860 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); | 857 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); |
861 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); | 858 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); |
862 } | 859 } |
863 | 860 |
864 } // namespace | 861 } // namespace |
865 } // namespace test | 862 } // namespace test |
866 } // namespace net | 863 } // namespace net |
OLD | NEW |