Skip to content

Commit

Permalink
[fix][client] Prevent DNS reverse lookup when physical address is an …
Browse files Browse the repository at this point in the history
…IP address (apache#19028)

(cherry picked from commit d8569cd)
  • Loading branch information
lhotari authored and michaeljmarshall committed Jan 31, 2023
1 parent 0dfbc61 commit 5385f3b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void failure(Throwable failure) {
private URI replaceWithNew(InetSocketAddress address, URI uri) {
String originalUri = uri.toString();
String newUri = (originalUri.split(":")[0] + "://")
+ address.getHostName() + ":"
+ address.getHostString() + ":"
+ address.getPort()
+ uri.getRawPath();
if (uri.getRawQuery() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private CompletableFuture<ClientCnx> createConnection(InetSocketAddress logicalA
cnx.setTargetBroker(logicalAddress);
}

cnx.setRemoteHostName(physicalAddress.getHostName());
cnx.setRemoteHostName(physicalAddress.getHostString());

cnx.connectionFuture().thenRun(() -> {
if (log.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public InetSocketAddress resolveHost() {
@Override
public URI resolveHostUri() {
InetSocketAddress host = resolveHost();
String hostUrl = serviceUri.getServiceScheme() + "://" + host.getHostName() + ":" + host.getPort();
String hostUrl = serviceUri.getServiceScheme() + "://" + host.getHostString() + ":" + host.getPort();
return URI.create(hostUrl);
}

Expand Down

0 comments on commit 5385f3b

Please sign in to comment.