From ee50ce404201e8509e51fd88fd98411d7711600f Mon Sep 17 00:00:00 2001 From: Jeff Mesnil Date: Thu, 6 Apr 2017 15:30:06 +0200 Subject: [PATCH] [ARTEMIS-1043] Support IPv6 in NettyConnector Call IPV6Util.encloseHost when creating the uri used to send the HTTP ugrade request to ensure that IPv6 address are properly enclosed. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1043 --- .../artemis/core/remoting/impl/netty/NettyConnector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index d31bdb2ef0..ad789087b8 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -107,6 +107,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.FutureLatch; +import org.apache.activemq.artemis.utils.IPV6Util; import org.jboss.logging.Logger; import static org.apache.activemq.artemis.utils.Base64.encodeBytes; @@ -686,7 +687,7 @@ public class NettyConnector extends AbstractConnector { if (sslEnabled) { scheme = "https"; } - URI uri = new URI(scheme, null, host, port, null, null, null); + URI uri = new URI(scheme, null, IPV6Util.encloseHost(host), port, null, null, null); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri.getRawPath()); request.headers().set(HttpHeaders.Names.HOST, host); request.headers().set(HttpHeaders.Names.UPGRADE, ACTIVEMQ_REMOTING);