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 2020/05/05 11:56:53 UTC
[tomcat] branch 7.0.x updated: Remove tests for BZ 63835 that was
not back-ported to 7.0.x
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push:
new 729176e Remove tests for BZ 63835 that was not back-ported to 7.0.x
729176e is described below
commit 729176e2b6b386fda05ac9ffc72d6ccfdf885023
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 5 12:56:28 2020 +0100
Remove tests for BZ 63835 that was not back-ported to 7.0.x
---
.../coyote/http11/TestAbstractHttp11Processor.java | 102 ---------------------
1 file changed, 102 deletions(-)
diff --git a/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java b/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
index b142431..0d9f0ed 100644
--- a/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
@@ -25,13 +25,11 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
-import java.io.StringReader;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.CharBuffer;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -58,7 +56,6 @@ import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.startup.TomcatBaseTest;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.ByteChunk;
-import org.apache.tomcat.util.http.parser.TokenList;
public class TestAbstractHttp11Processor extends TomcatBaseTest {
@@ -1598,105 +1595,6 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest {
}
- @Test
- public void testKeepAliveHeader01() throws Exception {
- doTestKeepAliveHeader(false, 3000, 10);
- }
-
- @Test
- public void testKeepAliveHeader02() throws Exception {
- doTestKeepAliveHeader(true, 5000, 1);
- }
-
- @Test
- public void testKeepAliveHeader03() throws Exception {
- doTestKeepAliveHeader(true, 5000, 10);
- }
-
- @Test
- public void testKeepAliveHeader04() throws Exception {
- doTestKeepAliveHeader(true, -1, 10);
- }
-
- @Test
- public void testKeepAliveHeader05() throws Exception {
- doTestKeepAliveHeader(true, -1, 1);
- }
-
- @Test
- public void testKeepAliveHeader06() throws Exception {
- doTestKeepAliveHeader(true, -1, -1);
- }
-
- private void doTestKeepAliveHeader(boolean sendKeepAlive, int keepAliveTimeout,
- int maxKeepAliveRequests) throws Exception {
- Tomcat tomcat = getTomcatInstance();
-
- tomcat.getConnector().setProperty("keepAliveTimeout", Integer.toString(keepAliveTimeout));
- tomcat.getConnector().setProperty("maxKeepAliveRequests", Integer.toString(maxKeepAliveRequests));
-
- // No file system docBase required
- Context ctx = tomcat.addContext("", null);
-
- // Add servlet
- Tomcat.addServlet(ctx, "TesterServlet", new TesterServlet());
- ctx.addServletMapping("/foo", "TesterServlet");
-
- tomcat.start();
-
- String request =
- "GET /foo HTTP/1.1" + SimpleHttpClient.CRLF +
- "Host: localhost:" + getPort() + SimpleHttpClient.CRLF;
-
- if (sendKeepAlive) {
- request += "Connection: keep-alive" + SimpleHttpClient.CRLF;
- }
-
- request += SimpleHttpClient.CRLF;
-
- Client client = new Client(tomcat.getConnector().getLocalPort());
- client.setRequest(new String[] {request});
-
- client.connect();
- client.processRequest(false);
-
- Assert.assertTrue(client.isResponse200());
-
- String connectionHeaderValue = null;
- String keepAliveHeaderValue = null;
- for (String header : client.getResponseHeaders()) {
- if (header.startsWith("Connection:")) {
- connectionHeaderValue = header.substring(header.indexOf(':') + 1).trim();
- }
- if (header.startsWith("Keep-Alive:")) {
- keepAliveHeaderValue = header.substring(header.indexOf(':') + 1).trim();
- }
- }
-
- if (!sendKeepAlive || keepAliveTimeout < 0
- && (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
- Assert.assertNull(connectionHeaderValue);
- Assert.assertNull(keepAliveHeaderValue);
- } else {
- List<String> connectionHeaders = new ArrayList<String>();
- TokenList.parseTokenList(new StringReader(connectionHeaderValue), connectionHeaders);
-
- if (sendKeepAlive && keepAliveTimeout > 0 &&
- (maxKeepAliveRequests < 0 || maxKeepAliveRequests > 1)) {
- Assert.assertEquals(1, connectionHeaders.size());
- Assert.assertEquals("keep-alive", connectionHeaders.get(0));
- Assert.assertEquals("timeout=" + keepAliveTimeout / 1000L, keepAliveHeaderValue);
- }
-
- if (sendKeepAlive && maxKeepAliveRequests == 1) {
- Assert.assertEquals(1, connectionHeaders.size());
- Assert.assertEquals("close", connectionHeaders.get(0));
- Assert.assertNull(keepAliveHeaderValue);
- }
- }
- }
-
-
/**
* Test servlet that prints out the values of
* HttpServletRequest.getServerName() and
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org