This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 8d281dac19 Review "Bound-check the AJP response header code lookup"
8d281dac19 is described below
commit 8d281dac19613d0ad510d961c6974fc794c9dc83
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 30 20:56:42 2026 +0000
Review "Bound-check the AJP response header code lookup"
Simplify
---
java/org/apache/coyote/ajp/Constants.java | 5 ++++-
test/org/apache/coyote/ajp/TestConstants.java | 1 -
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/coyote/ajp/Constants.java
b/java/org/apache/coyote/ajp/Constants.java
index 7a94798532..606dd28b5a 100644
--- a/java/org/apache/coyote/ajp/Constants.java
+++ b/java/org/apache/coyote/ajp/Constants.java
@@ -145,7 +145,10 @@ public final class Constants {
/**
* Maximum number of response header codes.
+ *
+ * @deprecated Unused. Will be removed in Tomcat 12 onwards
*/
+ @Deprecated
public static final int SC_RESP_AJP13_MAX = 11;
// Integer codes for common (optional) request attribute names
@@ -406,7 +409,7 @@ public final class Constants {
private static final Map<String,Integer> responseTransMap = new
HashMap<>(20);
static {
- for (int i = 0; i < SC_RESP_AJP13_MAX; i++) {
+ for (int i = 0; i < responseTransArray.length; i++) {
responseTransMap.put(getResponseHeaderForCode(i),
Integer.valueOf(0xA001 + i));
}
}
diff --git a/test/org/apache/coyote/ajp/TestConstants.java
b/test/org/apache/coyote/ajp/TestConstants.java
index e07958bb37..87976f0bb3 100644
--- a/test/org/apache/coyote/ajp/TestConstants.java
+++ b/test/org/apache/coyote/ajp/TestConstants.java
@@ -30,7 +30,6 @@ public class TestConstants {
@Test
public void testGetResponseHeaderForCodeOutOfBounds() {
Assert.assertNull(Constants.getResponseHeaderForCode(-1));
-
Assert.assertNull(Constants.getResponseHeaderForCode(Constants.SC_RESP_AJP13_MAX));
Assert.assertNull(Constants.getResponseHeaderForCode(Integer.MAX_VALUE));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]