This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new a3193dd4d3 Follow-on to "Allow re-adding a host that was previously
removed..."
a3193dd4d3 is described below
commit a3193dd4d37e092061a33b4e27bcab0dc8a95cd8
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 | 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 d1d0de5c04..4f421dcf52 100644
--- a/java/org/apache/catalina/manager/host/HostManagerServlet.java
+++ b/java/org/apache/catalina/manager/host/HostManagerServlet.java
@@ -25,6 +25,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;
@@ -309,7 +310,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);
+ }
+ }
/**
@@ -340,6 +347,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));
@@ -456,6 +466,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));
@@ -534,6 +547,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
@@ -585,6 +601,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
@@ -676,6 +695,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 9f00fe22d4..843d066f46 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -108,6 +108,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 11.0.28 (markt)" 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 11.0.27 (markt)" rtext="release in progress">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]