You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/06/02 22:48:01 UTC
svn commit: r1683182 - in /tomcat/trunk/test/org/apache/coyote/http2:
Http2TestBase.java TestHttp2Section_3_5.java
Author: markt
Date: Tue Jun 2 20:48:01 2015
New Revision: 1683182
URL: http://svn.apache.org/r1683182
Log:
Confirm connection is dropped if the client preface is skipped
Added:
tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java (with props)
Modified:
tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1683182&r1=1683181&r2=1683182&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Tue Jun 2 20:48:01 2015
@@ -54,6 +54,10 @@ public abstract class Http2TestBase exte
{ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 };
static final String EMPTY_HTTP2_SETTINGS_HEADER;
+ private static final byte[] PING_FRAME = new byte[] {
+ 0x00, 0x00, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
static {
byte[] empty = new byte[0];
EMPTY_HTTP2_SETTINGS_HEADER = "HTTP2-Settings: " + Base64.encodeBase64String(empty) + "\r\n";
@@ -252,6 +256,12 @@ public abstract class Http2TestBase exte
os.flush();
}
+
+ void sendPing() throws IOException {
+ os.write(PING_FRAME);
+ os.flush();
+ }
+
private static class TestInput implements Http2Parser.Input {
Added: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java?rev=1683182&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java (added)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java Tue Jun 2 20:48:01 2015
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.coyote.http2;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+public class TestHttp2Section_3_5 extends Http2TestBase {
+
+ @Test(expected=IOException.class)
+ public void testNoConnectionPreface() throws Exception {
+ enableHttp2();
+ configureAndStartWebApplication();
+ openClientConnection();
+ doHttpUpgrade();
+ // Should send client preface here
+ sendPing();
+ // Send several pings else server will block waiting for the client
+ // preface which is longer than a single ping.
+ sendPing();
+ sendPing();
+ validateHttp2InitialResponse();
+ }
+}
Propchange: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_3_5.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org