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 a0d4fe0a02 Add additional unit tests a0d4fe0a02 is described below commit a0d4fe0a02b0d69bb4b6dccea011debe51b8572c Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Nov 11 17:01:24 2024 +0000 Add additional unit tests --- test/org/apache/tomcat/util/buf/TestUDecoder.java | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/org/apache/tomcat/util/buf/TestUDecoder.java b/test/org/apache/tomcat/util/buf/TestUDecoder.java index b2ca73dd16..94dbd14fb6 100644 --- a/test/org/apache/tomcat/util/buf/TestUDecoder.java +++ b/test/org/apache/tomcat/util/buf/TestUDecoder.java @@ -219,6 +219,48 @@ public class TestUDecoder { } + @Test + public void testURLDecodeStringSolidus10a() throws IOException { + String result = doTestSolidus("xx%25xx", EncodedSolidusHandling.REJECT); + Assert.assertEquals("xx%xx", result); + } + + + @Test + public void testURLDecodeStringSolidus10b() throws IOException { + String result = doTestSolidus("xx%25xx", EncodedSolidusHandling.PASS_THROUGH); + Assert.assertEquals("xx%25xx", result); + } + + + @Test + public void testURLDecodeStringSolidus10c() throws IOException { + String result = doTestSolidus("xx%25xx", EncodedSolidusHandling.DECODE); + Assert.assertEquals("xx%xx", result); + } + + + @Test(expected = CharConversionException.class) + public void testURLDecodeStringSolidus11a() throws IOException { + String result = doTestSolidus("xx%2f%25xx", EncodedSolidusHandling.REJECT); + Assert.assertEquals("xx%xx", result); + } + + + @Test + public void testURLDecodeStringSolidus11b() throws IOException { + String result = doTestSolidus("xx%2f%25xx", EncodedSolidusHandling.PASS_THROUGH); + Assert.assertEquals("xx%2f%25xx", result); + } + + + @Test + public void testURLDecodeStringSolidus11c() throws IOException { + String result = doTestSolidus("xx%2f%25xx", EncodedSolidusHandling.DECODE); + Assert.assertEquals("xx/%xx", result); + } + + private void doTestSolidus(String input, String expected) throws IOException { for (EncodedSolidusHandling solidusHandling : EncodedSolidusHandling.values()) { String result = doTestSolidus(input, solidusHandling); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org