-
Bug
-
Resolution: Done
-
Major
-
4.1.0.Beta1
-
None
When doing an http upgrade, remoting tries to resolve hostname constructing URI. But if user has specified IP address to the remote endpoint that has a wrong reverse DNS entry, then the resulting URL would be wrong.
I observed this on windows running wildfly testsuite with such IP. Because windows resolves back local IPs with wrong reverse entries to the computer name. I think it makes more sense to obey user choice if user has specified an IP address instead of a hostname.
So this is my proposed solution to the problem and I have tested that it helps with wildfly in the said environment:
diff --git a/src/main/java/org/jboss/remoting3/remote/HttpUpgradeConnectionProvider. index 8227984..643e0ff 100644 --- a/src/main/java/org/jboss/remoting3/remote/HttpUpgradeConnectionProvider.java +++ b/src/main/java/org/jboss/remoting3/remote/HttpUpgradeConnectionProvider.java @@ -97,7 +97,7 @@ final class HttpUpgradeConnectionProvider extends RemoteConnection InetSocketAddress destination = (InetSocketAddress) dst; final URI uri; try { - uri = new URI("http", "", destination.getHostName(), destination.getPor + uri = new URI("http", "", destination.getHostString(), destination.getP } catch (URISyntaxException e) { return new FailedIoFuture<ConnectedStreamChannel>(new IOException(e)); } @@ -132,7 +132,7 @@ final class HttpUpgradeConnectionProvider extends RemoteConnecti protected IoFuture<ConnectedSslStreamChannel> createSslConnection(final SocketA final URI uri; try { - uri = new URI("https", "", destination.getHostName(), destination.getPo + uri = new URI("https", "", destination.getHostString(), destination.get } catch (URISyntaxException e) { return new FailedIoFuture<ConnectedSslStreamChannel>(new IOException(e) }
I'll make a pull request in a minute.