(tomcat) branch 9.0.x updated: Expand test case to confirm bug report is invalid

[email protected]
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <178634845864.1574098.11177296379678198886@gitbox3-he-fi.apache.org>
This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 94fb98deff Expand test case to confirm bug report is invalid
94fb98deff is described below

commit 94fb98deffce1723c489103e5ed00e1ae0950adf
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Aug 10 08:36:00 2026 +0100

    Expand test case to confirm bug report is invalid
---
 .../apache/catalina/connector/TestConnector.java   | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/test/org/apache/catalina/connector/TestConnector.java b/test/org/apache/catalina/connector/TestConnector.java
index eb1eb94cf0..91ec3a08b0 100644
--- a/test/org/apache/catalina/connector/TestConnector.java
+++ b/test/org/apache/catalina/connector/TestConnector.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import javax.servlet.Servlet;
 
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.catalina.Context;
@@ -215,4 +216,47 @@ public class TestConnector extends TomcatBaseTest {
             Assert.assertFalse(foundTrace);
         }
     }
+
+
+    /*
+     * This is applies to the entire test class although it is only required for the following two tests. That makes it
+     * fragile. This setting and the tests that depend on it may need to be moved to a dedicated test class in the
+     * future.
+     */
+    @BeforeClass
+    public static void setup() {
+        System.setProperty("org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH", "true");
+    }
+
+
+    @Test
+    public void testBug70144a() throws Exception {
+        // Simple test case
+        doTestBug70144("/bug%5C70144");
+    }
+
+
+    @Test
+    public void testBug70144b() throws Exception {
+        // User provided test case
+        doTestBug70144("/search/%22F%5C%22%22");
+    }
+
+
+    private void doTestBug70144(String path) throws Exception {
+
+        Tomcat tomcat = getTomcatInstance();
+
+        Context root = getProgrammaticRootContext();
+        Tomcat.addServlet(root, "default", new TesterServlet());
+        root.addServletMappingDecoded("/", "default");
+
+        tomcat.start();
+
+        ByteChunk body = new ByteChunk();
+        int rc = getUrl("http://localhost:" + getPort() + path, body, true);
+
+        Assert.assertEquals(200, rc);
+        Assert.assertEquals("OK", body.toString());
+    }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.