Skip to content

Commit

Permalink
Merge pull request #3992 from pavangabani/master
Browse files Browse the repository at this point in the history
Add IPv6 support to H2 Console
  • Loading branch information
katzyn committed Feb 1, 2024
2 parents 906edeb + dc9cde4 commit 9378cfe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions h2/src/main/org/h2/server/web/WebThread.java
Expand Up @@ -250,15 +250,19 @@ private boolean checkHost(String host) throws IOException {
writeSimple("HTTP/1.1 400 Bad Request", "Bad request");
return false;
}
int index = host.indexOf(':');
int index = host.lastIndexOf(':');

if (index >= 0) {
host = host.substring(0, index);
}
if (host.isEmpty()) {
return false;
}
host = StringUtils.toLowerEnglish(host);
if (host.equals(server.getHost()) || host.equals("localhost") || host.equals("127.0.0.1")) {
if (host.equals(server.getHost()) ||
host.equals("localhost") ||
host.equals("127.0.0.1") ||
host.equals("[::1]")) {
return true;
}
String externalNames = server.getExternalNames();
Expand Down

0 comments on commit 9378cfe

Please sign in to comment.