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 dff8d7d65f Follow-on to "Allow re-adding a host that was previously
removed..." # Conflicts: # webapps/docs/changelog.xml
dff8d7d65f is described below
commit dff8d7d65f3ff282e101e91938c15d4de52c69de
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..."
# Conflicts:
# webapps/docs/changelog.xml
---
.../catalina/manager/host/HostManagerServlet.java | 24 +++++++++++++++++++++-
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/manager/host/HostManagerServlet.java
b/java/org/apache/catalina/manager/host/HostManagerServlet.java
index dd99b65174..bc1ff47520 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;
@@ -306,7 +307,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);
+ }
+ }
/**
@@ -337,6 +344,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));
@@ -453,6 +463,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));
@@ -531,6 +544,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
@@ -582,6 +598,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
@@ -673,6 +692,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 cf03044a54..594998c0de 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -118,6 +118,14 @@
</fix>
</changelog>
</subsection>
+ <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 9.0.123 (remm)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]