Skip unnecessary DNS resolution when creating AuthenticationDataHttp instance
*/
package org.apache.pulsar.broker.authentication;
+import io.netty.util.NetUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import javax.servlet.http.HttpServletRequest;
@@ -34,7 +35,9 @@ public class AuthenticationDataHttp implements AuthenticationDataSource {
throw new IllegalArgumentException();
}
this.request = request;
- this.remoteAddress = new InetSocketAddress(request.getRemoteAddr(), request.getRemotePort());
+ this.remoteAddress =
+ new InetSocketAddress(NetUtil.createInetAddressFromIpAddressString(request.getRemoteAddr()),
+ request.getRemotePort());
}
/*
