Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45211954E for ; Tue, 25 Oct 2011 16:58:54 +0000 (UTC) Received: (qmail 56712 invoked by uid 500); 25 Oct 2011 16:58:53 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 56599 invoked by uid 500); 25 Oct 2011 16:58:53 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 56536 invoked by uid 99); 25 Oct 2011 16:58:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 16:58:53 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 16:58:51 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 979CE31B0F0 for ; Tue, 25 Oct 2011 16:56:32 +0000 (UTC) Date: Tue, 25 Oct 2011 16:56:32 +0000 (UTC) From: "Ketan (Commented) (JIRA)" To: issues@commons.apache.org Message-ID: <511869211.14185.1319561792622.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1045372114.6181.1319340452228.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (NET-426) FTPS: Hook to customize _openDataConnection_ SSLSocket before startHandshake() is called MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NET-426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13135229#comment-13135229 ] Ketan commented on NET-426: --------------------------- Here is code snippet I was playing with. I had this executed before data connection handshake starting. Note this is for SunJSSE provider since I had Sun's JVM installed: SSLSocket sslControlSocket = (SSLSocket) controlConnectionSocket; String host = "host.used.to.connect.to.socket"; try { SSLSession sess = sslControlSocket.getSession(); SSLSessionContext sessions = sess.getSessionContext(); // SunJSSE 1.6 specific code Field cache = sessions.getClass().getDeclaredField( "sessionHostPortCache"); cache.setAccessible(true); Object c = cache.get(sessions); String key = (host + ":" + String.valueOf(socket.getPort())) .toLowerCase(); // Class cc = Class.forName("sun.security.util.Cache"); Class cc = c.getClass(); cc.getDeclaredMethod("put", Object.class, Object.class).invoke( c, key, sess); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } > FTPS: Hook to customize _openDataConnection_ SSLSocket before startHandshake() is called > ---------------------------------------------------------------------------------------- > > Key: NET-426 > URL: https://issues.apache.org/jira/browse/NET-426 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 3.0.1 > Reporter: Ketan > Priority: Critical > Attachments: FTPSClient.patch > > Original Estimate: 1h > Remaining Estimate: 1h > > Currently in FTPSClient class, there is protected _openDataConnection_ method, which create SSLSocket for data connection. But there is no hook to customize the SSLSocket before startHandshake is called. > I need to know the remote host ip and port, which i can get for socket, and do custom setup to try to reuse SSL sessions from control connection socket. Since the socket factory uses createSocket() method, I can't just use custom socket factory since I don't know the host and port. I can't just override the _openDataConnection_() method in my class since that will call the startHandshake(). > So it would be nice if you can provide hook, much like _connectAction_(), but for data connection before handshake is started. You can pass the new data socket as argument to this hook method so one can get remote host and port information. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira