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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 1123153003: Reject empty protocol id in HTTP/2 ALTSVC frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/spdy_framer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer_test.cc
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index fe7d4b81b24a8e3ee8efda59fcd08831d1337ca6..4e69b207e79ae6a98802824d516848c7d6184790 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -5755,6 +5755,32 @@ TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
<< SpdyFramer::ErrorCodeToString(framer.error_code());
}
+TEST_P(SpdyFramerTest, OnAltSvcEmptyProtocolId) {
+ if (spdy_version_ <= SPDY3) {
+ return;
+ }
+
+ testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
+ SpdyFramer framer(spdy_version_);
+ framer.set_visitor(&visitor);
+
+ EXPECT_CALL(visitor, OnError(testing::Eq(&framer)));
+
+ SpdyAltSvcIR altsvc_ir(1);
+ altsvc_ir.set_max_age(10);
+ altsvc_ir.set_port(443);
+ altsvc_ir.set_host("h1");
+ altsvc_ir.set_origin("o1");
+ scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(altsvc_ir));
+ framer.ProcessInput(frame->data(), framer.GetAltSvcMinimumSize() +
+ altsvc_ir.protocol_id().length() +
+ altsvc_ir.host().length());
+
+ EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
+ EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
+}
+
TEST_P(SpdyFramerTest, OnAltSvcBadLengths) {
if (spdy_version_ <= SPDY3) {
return;
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698