File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
java/src/main/java/com/genexus/internet Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2222import org .apache .http .conn .ssl .NoopHostnameVerifier ;
2323import org .apache .http .entity .ContentType ;
2424import org .apache .http .impl .conn .PoolingHttpClientConnectionManager ;
25+ import org .apache .http .impl .conn .SystemDefaultDnsResolver ;
2526import org .apache .http .protocol .HttpContext ;
2627import org .apache .http .auth .AuthSchemeProvider ;
2728import org .apache .http .auth .AuthScope ;
@@ -68,6 +69,19 @@ public HttpClientJavaLib() {
6869 getPoolInstance ();
6970 ConnectionKeepAliveStrategy myStrategy = generateKeepAliveStrategy ();
7071 httpClientBuilder = HttpClients .custom ().setConnectionManager (connManager ).setConnectionManagerShared (true ).setKeepAliveStrategy (myStrategy );
72+ String gxDns = System .getenv ("GX_USE_FIRST_IP_DNS" );
73+ if (gxDns == null || gxDns .trim ().isEmpty ()) {
74+ gxDns = System .getProperty ("GX_USE_FIRST_IP_DNS" );
75+ }
76+ if (gxDns != null && gxDns .trim ().equalsIgnoreCase ("true" )) {
77+ httpClientBuilder .setDnsResolver (new SystemDefaultDnsResolver () {
78+ @ Override
79+ public InetAddress [] resolve (String host ) throws UnknownHostException {
80+ InetAddress [] all = super .resolve (host );
81+ return new InetAddress [] { all [0 ] };
82+ }
83+ });
84+ }
7185 cookies = new BasicCookieStore ();
7286 streamsToClose = new Vector <>();
7387 }
You can’t perform that action at this time.
0 commit comments