Author: markt Date: Tue Jun 16 21:36:56 2015 New Revision: 1685913 URL: http://svn.apache.org/r1685913 Log: HTTP/2 streams may not depend on themselves.
Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_3.java Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java?rev=1685913&r1=1685912&r2=1685913&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2Parser.java Tue Jun 16 21:36:56 2015 @@ -231,6 +231,11 @@ class Http2Parser { int parentStreamId = ByteUtil.get31Bits(payload, 0); int weight = ByteUtil.getOneByte(payload, 4) + 1; + if (streamId == parentStreamId) { + throw new StreamException(sm.getString("http2Parser.processFramePriority.invalidParent", + connectionId, Integer.valueOf(streamId)), Http2Error.PROTOCOL_ERROR, streamId); + } + output.reprioritise(streamId, parentStreamId, exclusive, weight); } Modified: tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1685913&r1=1685912&r2=1685913&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Tue Jun 16 21:36:56 2015 @@ -48,6 +48,7 @@ http2Parser.processFrameGoaway.payloadTo http2Parser.processFrameHeaders.decodingFailed=There was an error during the HPACK decoding of HTTP headers http2Parser.processFrameHeaders.decodingDataLeft=Data left over after HPACK decoding - it should have been consumed http2Parser.processFramePing.invalidPayloadSize=Settings frame received with an invalid payload size of [{0}] (should be 8) +http2Parser.processFramePriority.invalidParent=Connection [{0}], Stream [{1}], A stream may not depend on itself http2Parser.processFramePriority.invalidPayloadSize=Priority frame received with an invalid payload size of [{0}] (should be 5) http2Parser.processFramePushPromise=Connection [{0}], Stream [{1}], Push promise frames should not be sent by the client http2Parser.processFrameSettings.ackWithNonZeroPayload=Settings frame received with the ACK flag set and payload present Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_3.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_3.java?rev=1685913&r1=1685912&r2=1685913&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_3.java (original) +++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_5_3.java Tue Jun 16 21:36:56 2015 @@ -31,6 +31,20 @@ import org.junit.Test; */ public class TestHttp2Section_5_3 extends Http2TestBase { + // Section 5.3.1 + + @Test + public void testStreamDependsOnSelf() throws Exception { + http2Connect(); + + sendPriority(3, 3, 15); + + parser.readFrame(true); + + Assert.assertEquals("3-RST-[1]", output.getTrace()); + } + + // Section 5.3.2 @Test --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org