You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "John van der Kamp (Jira)" <ji...@apache.org> on 2025/08/01 08:20:00 UTC
[jira] [Commented] (NET-735) IMAP missing timeout on SSL handshake
[ https://issues.apache.org/jira/browse/NET-735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18011377#comment-18011377 ]
John van der Kamp commented on NET-735:
---------------------------------------
That is what my patch is doing, right?
[https://github.com/apache/commons-net/blob/master/src/main/java/org/apache/commons/net/imap/IMAPSClient.java#L282]
Line 282 makes the socket, line 296 does startHandshake which already initiates the connection and setting a timeout after this would be too late.
> IMAP missing timeout on SSL handshake
> -------------------------------------
>
> Key: NET-735
> URL: https://issues.apache.org/jira/browse/NET-735
> Project: Commons Net
> Issue Type: Bug
> Components: IMAP
> Affects Versions: 3.5, 3.11.1
> Reporter: John van der Kamp
> Priority: Major
>
> When an SSL handshake is not being received due to network issues, this is not detected and the connection hangs waiting for data. The code does not install a timeout on the ssl socket.
>
> We are using the following patch to fix this:
>
> {{--- commons-net/commons-net/3.11.1/commons-net-3.11.1-sources/org/apache/commons/net/imap/IMAPSClient.java}}
> {{+++ commons-net/commons-net/3.11.1/commons-net-3.11.1-sources/org/apache/commons/net/imap/IMAPSClient.java}}
> {{@@ -282,6 +282,7 @@ public class IMAPSClient extends IMAPClient {}}
> {{ final SSLSocket socket = (SSLSocket) ssf.createSocket(_socket_, host, port, true);}}
> {{ socket.setEnableSessionCreation(true);}}
> {{ socket.setUseClientMode(true);}}
> {{+ socket.setSoTimeout(1000);}}
> {{ }}
> {{ if (tlsEndpointChecking) {}}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)