This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit dc170c7a6c045dc54f4b2fac335f0c8fd1b6b742 Author: Mark Thomas <[email protected]> AuthorDate: Wed Oct 7 15:54:56 2026 +0100 Follow-on to "Allow re-adding a host that was previously removed..." --- .../catalina/manager/host/HostManagerServlet.java | 24 +++++++++++++++++++++- webapps/docs/changelog.xml | 12 ++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/manager/host/HostManagerServlet.java b/java/org/apache/catalina/manager/host/HostManagerServlet.java index 45b105db0e..4bd9d6cd68 100644 --- a/java/org/apache/catalina/manager/host/HostManagerServlet.java +++ b/java/org/apache/catalina/manager/host/HostManagerServlet.java @@ -24,6 +24,7 @@ import java.lang.management.ManagementFactory; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.util.Locale; import java.util.StringTokenizer; import javax.management.InstanceNotFoundException; @@ -307,7 +308,13 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet } - // -------------------------------------------------------- Private Methods + private static String normalizeHostName(String hostName) { + if (hostName == null) { + return null; + } else { + return hostName.toLowerCase(Locale.ENGLISH); + } + } /** @@ -338,6 +345,9 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet return; } + // Normalize host name before it is used + name = normalizeHostName(name); + // Check if host already exists if (engine.findChild(name) != null) { writer.println(smClient.getString("hostManagerServlet.alreadyHost", name)); @@ -454,6 +464,9 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet return; } + // Normalize host name before it is used + name = normalizeHostName(name); + // Check if host exists if (engine.findChild(name) == null) { writer.println(smClient.getString("hostManagerServlet.noHost", name)); @@ -532,6 +545,9 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet return; } + // Normalize host name before it is used + name = normalizeHostName(name); + Container host = engine.findChild(name); // Check if host exists @@ -583,6 +599,9 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet return; } + // Normalize host name before it is used + name = normalizeHostName(name); + Container host = engine.findChild(name); // Check if host exists @@ -674,6 +693,9 @@ public class HostManagerServlet extends HttpServlet implements ContainerServlet * @return the config base for the host */ protected File getConfigBase(String hostName, PrintWriter writer, StringManager smClient) { + // Normalize host name before it is used + hostName = normalizeHostName(hostName); + File configBase = new File(context.getCatalinaBase(), "conf"); if (!configBase.exists()) { return null; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 8a95bacc80..9f4bad879e 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -107,7 +107,17 @@ They eventually become mixed with the numbered issues (i.e., numbered issues do not "pop up" wrt. others). --> -<section name="Tomcat 10.1.61 (schultz)" rtext="in development"> +<section name="Tomcat 10.1.62 (schultz)" rtext="in development"> + <subsection name="Web applications"> + <changelog> + <fix> + Host Manager: Host names are now always converted to lower case before + use. (markt) + </fix> + </changelog> + </subsection> +</section> +<section name="Tomcat 10.1.61 (schultz)" rtext="release in progress"> <subsection name="Catalina"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
