Skip to content

Commit 0f83f48

Browse files
committed
Convert host names to lower case
1 parent c5f11a5 commit 0f83f48

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

h2/src/main/org/h2/server/web/WebServer.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public void init(String... args) {
321321
"webSSL", false);
322322
allowOthers = SortedProperties.getBooleanProperty(prop,
323323
"webAllowOthers", false);
324-
externalNames = SortedProperties.getStringProperty(prop, "webExternalNames", null);
324+
setExternalNames(SortedProperties.getStringProperty(prop, "webExternalNames", null));
325325
setAdminPassword(SortedProperties.getStringProperty(prop, "webAdminPassword", null));
326326
commandHistoryString = prop.getProperty(COMMAND_HISTORY);
327327
for (int i = 0; args != null && i < args.length; i++) {
@@ -333,7 +333,7 @@ public void init(String... args) {
333333
} else if (Tool.isOption(a, "-webAllowOthers")) {
334334
allowOthers = true;
335335
} else if (Tool.isOption(a, "-webExternalNames")) {
336-
externalNames = args[++i];
336+
setExternalNames(args[++i]);
337337
} else if (Tool.isOption(a, "-webDaemon")) {
338338
isDaemon = true;
339339
} else if (Tool.isOption(a, "-baseDir")) {
@@ -392,7 +392,7 @@ public String getHost() {
392392

393393
private void updateURL() {
394394
try {
395-
host = NetUtils.getLocalAddress();
395+
host = StringUtils.toLowerEnglish(NetUtils.getLocalAddress());
396396
StringBuilder builder = new StringBuilder(ssl ? "https" : "http").append("://")
397397
.append(host).append(':').append(port);
398398
if (key != null && serverSocket != null) {
@@ -568,7 +568,7 @@ public boolean getAllowOthers() {
568568
}
569569

570570
void setExternalNames(String externalNames) {
571-
this.externalNames = externalNames;
571+
this.externalNames = externalNames != null ? StringUtils.toLowerEnglish(externalNames) : null;
572572
}
573573

574574
String getExternalNames() {

h2/src/main/org/h2/server/web/WebThread.java

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ private boolean checkHost(String host) throws IOException {
256256
if (host.isEmpty()) {
257257
return false;
258258
}
259+
host = StringUtils.toLowerEnglish(host);
259260
if (host.equals(server.getHost()) || host.equals("localhost") || host.equals("127.0.0.1")) {
260261
return true;
261262
}

0 commit comments

Comments
 (0)