This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 8d2125fb55 Remove HTTP/0.9 tests
8d2125fb55 is described below
commit 8d2125fb550310757a956128d84b4ae5526278b5
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Dec 17 10:41:41 2025 +0000
Remove HTTP/0.9 tests
---
test/jakarta/servlet/http/TestHttpServlet.java | 11 +-----
.../apache/catalina/startup/SimpleHttpClient.java | 38 ++++++++-----------
.../coyote/http11/TestHttp11InputBufferCRLF.java | 43 ++++++++++------------
3 files changed, 36 insertions(+), 56 deletions(-)
diff --git a/test/jakarta/servlet/http/TestHttpServlet.java
b/test/jakarta/servlet/http/TestHttpServlet.java
index eeb420750d..eb0caa2919 100644
--- a/test/jakarta/servlet/http/TestHttpServlet.java
+++ b/test/jakarta/servlet/http/TestHttpServlet.java
@@ -246,12 +246,6 @@ public class TestHttpServlet extends TomcatBaseTest {
}
- @Test
- public void testUnimplementedMethodHttp09() throws Exception {
- doTestUnimplementedMethod("0.9");
- }
-
-
@Test
public void testUnimplementedMethodHttp10() throws Exception {
doTestUnimplementedMethod("1.0");
@@ -289,7 +283,7 @@ public class TestHttpServlet extends TomcatBaseTest {
request.append(CRLF);
- Client client = new Client(request.toString(),
"0.9".equals(httpVersion));
+ Client client = new Client(request.toString());
client.doRequest();
@@ -366,9 +360,8 @@ public class TestHttpServlet extends TomcatBaseTest {
private class Client extends SimpleHttpClient {
- Client(String request, boolean isHttp09) {
+ Client(String request) {
setRequest(new String[] { request });
- setUseHttp09(isHttp09);
}
private Exception doRequest() {
diff --git a/test/org/apache/catalina/startup/SimpleHttpClient.java
b/test/org/apache/catalina/startup/SimpleHttpClient.java
index 3587573ffe..770c0c778a 100644
--- a/test/org/apache/catalina/startup/SimpleHttpClient.java
+++ b/test/org/apache/catalina/startup/SimpleHttpClient.java
@@ -101,7 +101,6 @@ public abstract class SimpleHttpClient {
private String[] request;
private boolean useContinue = false;
private boolean useCookies = true;
- private boolean useHttp09 = false;
private int requestPause = 1000;
private Charset requestBodyEncoding = StandardCharsets.ISO_8859_1;
@@ -143,10 +142,6 @@ public abstract class SimpleHttpClient {
return useCookies;
}
- public void setUseHttp09(boolean theUseHttp09Flag) {
- useHttp09 = theUseHttp09Flag;
- }
-
public void setRequestPause(int theRequestPause) {
requestPause = theRequestPause;
}
@@ -274,27 +269,24 @@ public abstract class SimpleHttpClient {
bodyUriElements.clear();
}
- // HTTP 0.9 has neither response line nor headers
- if (!useHttp09) {
- // Read the response status line
- responseLine = readLine();
-
- // Is a 100 continue response expected?
- if (useContinue) {
- if (isResponse100()) {
- // Skip the blank after the 100 Continue response
- readLine();
- // Now get the final response
- responseLine = readLine();
- } else {
- throw new IOException("No 100 Continue response");
- }
- }
+ // Read the response status line
+ responseLine = readLine();
- // Put the headers into a map, and process interesting ones
- processHeaders();
+ // Is a 100 continue response expected?
+ if (useContinue) {
+ if (isResponse100()) {
+ // Skip the blank after the 100 Continue response
+ readLine();
+ // Now get the final response
+ responseLine = readLine();
+ } else {
+ throw new IOException("No 100 Continue response");
+ }
}
+ // Put the headers into a map, and process interesting ones
+ processHeaders();
+
// Read the body, if requested and if one exists
processBody(wantBody);
diff --git a/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
b/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
index 2c9ac6dea5..4747605f34 100644
--- a/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
+++ b/test/org/apache/coyote/http11/TestHttp11InputBufferCRLF.java
@@ -44,63 +44,62 @@ public class TestHttp11InputBufferCRLF extends
TomcatBaseTest {
List<Object[]> parameterSets = new ArrayList<>();
// Requests to exercise code that allows HT in place of SP
- parameterSets.add(new Object[] { Boolean.FALSE, new String[] {
+ parameterSets.add(new Object[] { new String[] {
"GET\t/test\tHTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF
+ "Connection: close" + CRLF + CRLF },
Boolean.TRUE });
// Standard HTTP/1.1 request
addRequestWithSplits(
"GET /test HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
"Connection: close" + CRLF + CRLF,
- Boolean.FALSE, parameterSets);
+ parameterSets);
// Standard HTTP/1.1 request with invalid HTTP protocol
addRequestWithSplits("GET /test HTTP/" + CR + "1.1" + CRLF + "Host:
localhost:8080" + CRLF +
- "Connection: close" + CRLF + CRLF, Boolean.FALSE,
Boolean.FALSE, parameterSets);
+ "Connection: close" + CRLF + CRLF, Boolean.FALSE,
parameterSets);
// Invalid (request target) HTTP/1.1 request
addRequestWithSplits(
"GET /te<st HTTP/1.1" + CRLF + "Host: localhost:8080" + CRLF +
"Connection: close" + CRLF + CRLF,
- Boolean.FALSE, Boolean.FALSE, parameterSets);
+ Boolean.FALSE, parameterSets);
// Invalid (use of CR) HTTP/1.1 request
addRequestWithSplits("GET /test HTTP/1.1" + CRLF + "Host:
localhost:8080" + CRLF + "Connection: close" + CRLF +
- "X-aaa: bbb" + CR + CRLF + CRLF, Boolean.FALSE, Boolean.FALSE,
parameterSets);
+ "X-aaa: bbb" + CR + CRLF + CRLF, Boolean.FALSE, parameterSets);
// Standard HTTP/1.1 request with a query string
addRequestWithSplits(
"GET /test?a=b HTTP/1.1" + CRLF + "Host: localhost:8080" +
CRLF + "Connection: close" + CRLF + CRLF,
- Boolean.FALSE, parameterSets);
+ parameterSets);
// Standard HTTP/1.1 request with a query string that includes ?
addRequestWithSplits(
"GET /test?a=?b HTTP/1.1" + CRLF + "Host: localhost:8080" +
CRLF + "Connection: close" + CRLF + CRLF,
- Boolean.FALSE, parameterSets);
+ parameterSets);
// Standard HTTP/1.1 request with an invalid query string
addRequestWithSplits(
"GET /test?a=<b HTTP/1.1" + CRLF + "Host: localhost:8080" +
CRLF + "Connection: close" + CRLF + CRLF,
- Boolean.FALSE, Boolean.FALSE, parameterSets);
+ Boolean.FALSE, parameterSets);
// Standard HTTP/1.1 request using LF rather than CRLF
addRequestWithSplits("GET /test HTTP/1.1" + LF + "Host:
localhost:8080" + LF + "Connection: close" + LF + LF,
- Boolean.FALSE, parameterSets);
+ parameterSets);
// Invalid HTTP/1.1 request using CR rather than CRLF
addRequestWithSplits("GET /test HTTP/1.1" + CR + "Host:
localhost:8080" + CR + "Connection: close" + CR + CR,
- Boolean.FALSE, Boolean.FALSE, parameterSets);
+ Boolean.FALSE, parameterSets);
return parameterSets;
}
- private static void addRequestWithSplits(String request, Boolean isHttp09,
List<Object[]> parameterSets) {
- addRequestWithSplits(request, isHttp09, Boolean.TRUE, parameterSets);
+ private static void addRequestWithSplits(String request, List<Object[]>
parameterSets) {
+ addRequestWithSplits(request, Boolean.TRUE, parameterSets);
}
- private static void addRequestWithSplits(String request, Boolean isHttp09,
Boolean valid,
- List<Object[]> parameterSets) {
+ private static void addRequestWithSplits(String request, Boolean valid,
List<Object[]> parameterSets) {
// Add as a single String
- parameterSets.add(new Object[] { isHttp09, new String[] { request },
valid });
+ parameterSets.add(new Object[] { new String[] { request }, valid });
// Add with all CRLF split between the CR and LF
List<String> parts = new ArrayList<>();
@@ -112,30 +111,27 @@ public class TestHttp11InputBufferCRLF extends
TomcatBaseTest {
pos = request.indexOf('\n', lastPos + 1);
}
parts.add(request.substring(lastPos));
- parameterSets.add(new Object[] { isHttp09, parts.toArray(new
String[0]), valid });
+ parameterSets.add(new Object[] { parts.toArray(new String[0]), valid
});
// Add with a split between each character
List<String> chars = new ArrayList<>();
for (char c : request.toCharArray()) {
chars.add(Character.toString(c));
}
- parameterSets.add(new Object[] { isHttp09, chars.toArray(new
String[0]), valid });
+ parameterSets.add(new Object[] { chars.toArray(new String[0]), valid
});
}
@Parameter(0)
- public boolean isHttp09;
-
- @Parameter(1)
public String[] request;
- @Parameter(2)
+ @Parameter(1)
public boolean valid;
@Test
public void testBug54947() {
- Client client = new Client(request, isHttp09);
+ Client client = new Client(request);
Exception e = client.doRequest();
@@ -153,9 +149,8 @@ public class TestHttp11InputBufferCRLF extends
TomcatBaseTest {
private class Client extends SimpleHttpClient {
- Client(String[] request, boolean isHttp09) {
+ Client(String[] request) {
setRequest(request);
- setUseHttp09(isHttp09);
}
private Exception doRequest() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]