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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 expected_header_set3["spam"] = "eggs"; | 344 expected_header_set3["spam"] = "eggs"; |
345 EXPECT_EQ(expected_header_set3, header_set3); | 345 EXPECT_EQ(expected_header_set3, header_set3); |
346 } | 346 } |
347 | 347 |
348 // Test a too-large indexed header. | 348 // Test a too-large indexed header. |
349 TEST_P(HpackDecoderTest, InvalidIndexedHeader) { | 349 TEST_P(HpackDecoderTest, InvalidIndexedHeader) { |
350 // High-bit set, and a prefix of one more than the number of static entries. | 350 // High-bit set, and a prefix of one more than the number of static entries. |
351 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1))); | 351 EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1))); |
352 } | 352 } |
353 | 353 |
354 // Test that a header block with a pseudo-header field following a regular one | |
355 // is treated as malformed. (HTTP2 draft-14 8.1.2.1., HPACK draft-09 3.1.) | |
356 | |
357 TEST_P(HpackDecoderTest, ContextUpdateMaximumSize) { | 354 TEST_P(HpackDecoderTest, ContextUpdateMaximumSize) { |
358 EXPECT_EQ(kDefaultHeaderTableSizeSetting, | 355 EXPECT_EQ(kDefaultHeaderTableSizeSetting, |
359 decoder_peer_.header_table()->max_size()); | 356 decoder_peer_.header_table()->max_size()); |
360 string input; | 357 string input; |
361 { | 358 { |
362 // Maximum-size update with size 126. Succeeds. | 359 // Maximum-size update with size 126. Succeeds. |
363 HpackOutputStream output_stream; | 360 HpackOutputStream output_stream; |
364 output_stream.AppendPrefix(kHeaderTableSizeUpdateOpcode); | 361 output_stream.AppendPrefix(kHeaderTableSizeUpdateOpcode); |
365 output_stream.AppendUint32(126); | 362 output_stream.AppendUint32(126); |
366 | 363 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" | 844 "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" |
848 " max-age=3600; version=1"); | 845 " max-age=3600; version=1"); |
849 expectEntry(63, 52, "content-encoding", "gzip"); | 846 expectEntry(63, 52, "content-encoding", "gzip"); |
850 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); | 847 expectEntry(64, 65, "date", "Mon, 21 Oct 2013 20:13:22 GMT"); |
851 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); | 848 EXPECT_EQ(215u, decoder_peer_.header_table()->size()); |
852 } | 849 } |
853 | 850 |
854 } // namespace | 851 } // namespace |
855 } // namespace test | 852 } // namespace test |
856 } // namespace net | 853 } // namespace net |
OLD | NEW |