Author: markt Date: Wed Sep 12 13:15:43 2018 New Revision: 1840681 URL: http://svn.apache.org/viewvc?rev=1840681&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62685 Correct an error in host name validation parsing that did not allow a fully qualified domain name to terminate with a period. Patch provided by AG.
Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestHttpParserHost.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1840681&r1=1840680&r2=1840681&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java Wed Sep 12 13:15:43 2018 @@ -865,7 +865,7 @@ public class HttpParser { NEW( true, false, false, false, " at the start of"), ALPHA( true, true, true, true, " after a letter in"), NUMERIC( true, true, true, true, " after a number in"), - PERIOD( true, false, false, false, " after a period in"), + PERIOD( true, false, false, true, " after a period in"), HYPHEN( true, true, false, false, " after a hypen in"), COLON( false, false, false, false, " after a colon in"), END( false, false, false, false, " at the end of"); Modified: tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestHttpParserHost.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestHttpParserHost.java?rev=1840681&r1=1840680&r2=1840681&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestHttpParserHost.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestHttpParserHost.java Wed Sep 12 13:15:43 2018 @@ -56,7 +56,6 @@ public class TestHttpParserHost { result.add(new Object[] { TestType.IPv4, "0.0.0.0:8080", Integer.valueOf(7), null} ); // IPv4 - invalid result.add(new Object[] { TestType.IPv4, ".0.0.0", Integer.valueOf(-1), IAE} ); - result.add(new Object[] { TestType.IPv4, "0.0.0.", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "0..0.0", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "0]", Integer.valueOf(-1), IAE} ); // Domain Name - valid @@ -126,14 +125,18 @@ public class TestHttpParserHost { result.add(new Object[] { TestType.IPv4, "myapp-t.my-domain.c-om", Integer.valueOf(-1), null} ); result.add(new Object[] { TestType.IPv4, "myapp-t.my-domain.c-om:8080", Integer.valueOf(22), null} ); result.add(new Object[] { TestType.IPv4, "gateway.demo-ilt-latest-demo:9000", Integer.valueOf(28), null} ); + // Domain Name with trailing dot - valid + result.add(new Object[] { TestType.IPv4, "0.0.0.", Integer.valueOf(-1), null} ); + result.add(new Object[] { TestType.IPv4, "myapp-t.mydomain.com.", Integer.valueOf(-1), null} ); + result.add(new Object[] { TestType.IPv4, "myapp-t.mydomain.com.:8080", Integer.valueOf(21), null} ); + result.add(new Object[] { TestType.IPv4, "foo.bar.", Integer.valueOf(-1), null} ); + result.add(new Object[] { TestType.IPv4, "foo.bar.:8080", Integer.valueOf(8), null} ); // Domain Name - invalid result.add(new Object[] { TestType.IPv4, ".", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, ".:8080", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, ".foo.bar", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "-foo.bar", Integer.valueOf(-1), IAE} ); - result.add(new Object[] { TestType.IPv4, "foo.bar.", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "foo.bar-", Integer.valueOf(-1), IAE} ); - result.add(new Object[] { TestType.IPv4, "foo.bar.:8080", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "foo.bar-:8080", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "^foo.bar", Integer.valueOf(-1), IAE} ); result.add(new Object[] { TestType.IPv4, "foo-.bar", Integer.valueOf(-1), IAE} ); Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1840681&r1=1840680&r2=1840681&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Sep 12 13:15:43 2018 @@ -53,6 +53,15 @@ </fix> </changelog> </subsection> + <subsection name="Coyote"> + <changelog> + <fix> + <bug>62685</bug>: Correct an error in host name validation parsing that + did not allow a fully qualified domain name to terminate with a period. + Patch provided by AG. (markt) + </fix> + </changelog> + </subsection> <subsection name="Jasper"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org