Skip to content

Commit

Permalink
Issue #1503 Optionally strip IPv6. Fixed inverted boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
gregw authored and joakime committed Jul 29, 2017
1 parent aadbb2d commit 76630cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java
Expand Up @@ -23,11 +23,11 @@
* <p>Parse a string in the form "host:port", handling IPv4 an IPv6 hosts</p>
*
* <p>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.</p>
* value to control of the square brackets are stripped off IPv6 addresses (default false).</p>
*/
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;
Expand All @@ -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)
{
Expand Down

0 comments on commit 76630cb

Please sign in to comment.