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

(cherry picked from commit e71b98a)
lhotari authored and codelipenghui committed Apr 28, 2022
1 parent bb52721 commit 663ebe0
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
@@ -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());
}

/*

0 comments on commit 663ebe0

Please sign in to comment.