Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1393)

Unified Diff: net/spdy/hpack_decoder_test.cc

Issue 531253004: HPACK: Check pseudo-header order in decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update examples_07.hpack. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/hpack_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_decoder_test.cc
diff --git a/net/spdy/hpack_decoder_test.cc b/net/spdy/hpack_decoder_test.cc
index ace9ac768bf6a17433e3b2a997c76c8a41cdf2ff..877692c30c4f45f53c1aee2ea9c5cf8855551f6c 100644
--- a/net/spdy/hpack_decoder_test.cc
+++ b/net/spdy/hpack_decoder_test.cc
@@ -257,6 +257,23 @@ TEST_F(HpackDecoderTest, InvalidIndexedHeader) {
EXPECT_FALSE(DecodeHeaderBlock(StringPiece("\xbe", 1)));
}
+// Test that a header block with a pseudo-header field following a regular one
+// is treated as malformed. (HTTP2 draft-14 8.1.2.1., HPACK draft-09 3.1.)
+
+TEST_F(HpackDecoderTest, InvalidPseudoHeaderPositionStatic) {
+ // Okay: ":path" (static entry 4) followed by "allow" (static entry 20).
+ EXPECT_TRUE(DecodeHeaderBlock(a2b_hex("8494")));
+ // Malformed: "allow" (static entry 20) followed by ":path" (static entry 4).
+ EXPECT_FALSE(DecodeHeaderBlock(a2b_hex("9484")));
+}
+
+TEST_F(HpackDecoderTest, InvalidPseudoHeaderPositionLiteral) {
+ // Okay: literal ":bar" followed by literal "foo".
+ EXPECT_TRUE(DecodeHeaderBlock(a2b_hex("40043a626172004003666f6f00")));
+ // Malformed: literal "foo" followed by literal ":bar".
+ EXPECT_FALSE(DecodeHeaderBlock(a2b_hex("4003666f6f0040043a62617200")));
+}
+
TEST_F(HpackDecoderTest, ContextUpdateMaximumSize) {
EXPECT_EQ(kDefaultHeaderTableSizeSetting,
decoder_peer_.header_table()->max_size());
« no previous file with comments | « net/spdy/hpack_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698