diff --git a/common/src/main/java/HTTPClient/HTTPConnection.java b/common/src/main/java/HTTPClient/HTTPConnection.java index 91eadf629..2a6d8c5f6 100644 --- a/common/src/main/java/HTTPClient/HTTPConnection.java +++ b/common/src/main/java/HTTPClient/HTTPConnection.java @@ -3323,11 +3323,7 @@ Response sendRequest(Request req, int con_timeout) Log.write(Log.CONN, "Conn: Retrying request"); continue; } - finally - { - if (sock != null) sock.close(); - } - + break; } @@ -3407,39 +3403,38 @@ Response sendRequest(Request req, int con_timeout) private Socket getSocket(int con_timeout) throws IOException { Socket sock = null; - try { - String actual_host; - int actual_port; + String actual_host; + int actual_port; - if (Proxy_Host != null) - { - actual_host = Proxy_Host; - actual_port = Proxy_Port; - } - else - { - actual_host = Host; - actual_port = Port; - } + if (Proxy_Host != null) + { + actual_host = Proxy_Host; + actual_port = Proxy_Port; + } + else + { + actual_host = Host; + actual_port = Port; + } - Log.write(Log.CONN, "Conn: Creating Socket: " + actual_host + ":" + + Log.write(Log.CONN, "Conn: Creating Socket: " + actual_host + ":" + actual_port); - if (con_timeout == 0) // normal connection establishment + if (con_timeout == 0) // normal connection establishment + { + if (Socks_client != null) + sock = Socks_client.getSocket(actual_host, actual_port); + else { - if (Socks_client != null) - sock = Socks_client.getSocket(actual_host, actual_port); - else + // try all A records + InetAddress[] addr_list = InetAddress.getAllByName(actual_host); + for (int idx=0; idx