From 76630cbf5b59aa3350700012a71ba34c9c4bb205 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 6 Jun 2017 17:04:49 +0200 Subject: [PATCH] Issue #1503 Optionally strip IPv6. Fixed inverted boolean --- .../src/main/java/org/eclipse/jetty/util/HostPort.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java b/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java index 5e4eba9481b5..250c296fae3a 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java @@ -23,11 +23,11 @@ *

Parse a string in the form "host:port", handling IPv4 an IPv6 hosts

* *

The System property "org.eclipse.jetty.util.HostPort.STRIP_IPV6" can be set to a boolean - * value to control of the square brackets are stripped off IPv6 addresses.

+ * value to control of the square brackets are stripped off IPv6 addresses (default false).

*/ public class HostPort { - private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","true")); + private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","false")); private final String _host; private final int _port; @@ -49,7 +49,7 @@ else if (authority.charAt(0)=='[') int close=authority.lastIndexOf(']'); if (close<0) throw new IllegalArgumentException("Bad IPv6 host"); - _host=STRIP_IPV6?authority.substring(0,close+1):authority.substring(1,close); + _host=STRIP_IPV6?authority.substring(1,close):authority.substring(0,close+1); if (authority.length()>close+1) {