Skip to content

Commit

Permalink
Improve skipping of DNS resolution when creating AuthenticationDataHt…
Browse files Browse the repository at this point in the history
…tp instance (#15228)

- improves solution added in #15221
  - It's better to use the JDK provided InetSocketAddress.createUnresolved method
    to prevent unnecessary DNS resolution
  • Loading branch information
lhotari committed Apr 20, 2022
1 parent 1e9a1f0 commit e71b98a
Showing 1 changed file with 1 addition and 4 deletions.
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.pulsar.broker.authentication;

import io.netty.util.NetUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -35,9 +34,7 @@ public AuthenticationDataHttp(HttpServletRequest request) {
throw new IllegalArgumentException();
}
this.request = request;
this.remoteAddress =
new InetSocketAddress(NetUtil.createInetAddressFromIpAddressString(request.getRemoteAddr()),
request.getRemotePort());
this.remoteAddress = InetSocketAddress.createUnresolved(request.getRemoteAddr(), request.getRemotePort());
}

/*
Expand Down

0 comments on commit e71b98a

Please sign in to comment.