Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 45387200B11 for ; Mon, 13 Jun 2016 11:24:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 43F55160A3C; Mon, 13 Jun 2016 09:24:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8834C160A19 for ; Mon, 13 Jun 2016 11:24:34 +0200 (CEST) Received: (qmail 1592 invoked by uid 500); 13 Jun 2016 09:24:33 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 1583 invoked by uid 99); 13 Jun 2016 09:24:33 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2016 09:24:33 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3BA26C1CFB for ; Mon, 13 Jun 2016 09:24:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.374 X-Spam-Level: X-Spam-Status: No, score=0.374 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id abuMIErH7vQT for ; Mon, 13 Jun 2016 09:24:32 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 294AA5F4E3 for ; Mon, 13 Jun 2016 09:24:32 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 66A19E00E7 for ; Mon, 13 Jun 2016 09:24:31 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 6256E3A02FD for ; Mon, 13 Jun 2016 09:24:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1748152 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/SocketClient.java Date: Mon, 13 Jun 2016 09:24:31 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160613092431.6256E3A02FD@svn01-us-west.apache.org> archived-at: Mon, 13 Jun 2016 09:24:35 -0000 Author: sebb Date: Mon Jun 13 09:24:30 2016 New Revision: 1748152 URL: http://svn.apache.org/viewvc?rev=1748152&view=rev Log: NET-593 HostnameVerifier is called with ip addess instead of the provided hostname Modified: commons/proper/net/trunk/src/changes/changes.xml commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java Modified: commons/proper/net/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1748152&r1=1748151&r2=1748152&view=diff ============================================================================== --- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original) +++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Mon Jun 13 09:24:30 2016 @@ -64,6 +64,9 @@ The type attribute can be add,u + + HostnameVerifier is called with ip addess instead of the provided hostname + TelnetClient._closeOutputStream unhandled exception from FilterOutputStream.close Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java?rev=1748152&r1=1748151&r2=1748152&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java Mon Jun 13 09:24:30 2016 @@ -178,15 +178,7 @@ public abstract class SocketClient throws SocketException, IOException { _hostname_ = null; - _socket_ = _socketFactory_.createSocket(); - if (receiveBufferSize != -1) { - _socket_.setReceiveBufferSize(receiveBufferSize); - } - if (sendBufferSize != -1) { - _socket_.setSendBufferSize(sendBufferSize); - } - _socket_.connect(new InetSocketAddress(host, port), connectTimeout); - _connectAction_(); + _connect(host, port, null, -1); } /** @@ -206,8 +198,8 @@ public abstract class SocketClient public void connect(String hostname, int port) throws SocketException, IOException { - connect(InetAddress.getByName(hostname), port); _hostname_ = hostname; + _connect(InetAddress.getByName(hostname), port, null, -1); } @@ -231,6 +223,13 @@ public abstract class SocketClient throws SocketException, IOException { _hostname_ = null; + _connect(host, port, localAddr, localPort); + } + + // helper method to allow code to be shared with connect(String,...) methods + private void _connect(InetAddress host, int port, InetAddress localAddr, int localPort) + throws SocketException, IOException + { _socket_ = _socketFactory_.createSocket(); if (receiveBufferSize != -1) { _socket_.setReceiveBufferSize(receiveBufferSize); @@ -238,12 +237,13 @@ public abstract class SocketClient if (sendBufferSize != -1) { _socket_.setSendBufferSize(sendBufferSize); } - _socket_.bind(new InetSocketAddress(localAddr, localPort)); + if (localAddr != null) { + _socket_.bind(new InetSocketAddress(localAddr, localPort)); + } _socket_.connect(new InetSocketAddress(host, port), connectTimeout); _connectAction_(); } - /** * Opens a Socket connected to a remote host at the specified port and * originating from the specified local address and port. @@ -264,8 +264,8 @@ public abstract class SocketClient InetAddress localAddr, int localPort) throws SocketException, IOException { - connect(InetAddress.getByName(hostname), port, localAddr, localPort); - _hostname_ = hostname; + _hostname_ = hostname; + _connect(InetAddress.getByName(hostname), port, localAddr, localPort); } @@ -303,8 +303,8 @@ public abstract class SocketClient */ public void connect(String hostname) throws SocketException, IOException { - connect(hostname, _defaultPort_); _hostname_ = hostname; + connect(hostname, _defaultPort_); }