You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/29 21:32:17 UTC
[commons-net] branch master updated: [NET-695] Apply SocketClient
timeout after connection but before SSL negotiation.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push:
new dc19e17 [NET-695] Apply SocketClient timeout after connection but before SSL negotiation.
dc19e17 is described below
commit dc19e1793db5b078f053c7b85e3a6459292d47cf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 29 16:32:13 2020 -0500
[NET-695] Apply SocketClient timeout after connection but before SSL
negotiation.
---
src/changes/changes.xml | 3 +++
src/main/java/org/apache/commons/net/SocketClient.java | 7 ++++++-
src/main/java/org/apache/commons/net/ftp/FTPSClient.java | 1 +
src/main/java/org/apache/commons/net/pop3/POP3SClient.java | 1 +
src/main/java/org/apache/commons/net/smtp/SMTPSClient.java | 1 +
5 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e494034..e9f8b7d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -91,6 +91,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="NET-685" type="update" dev="ggregory" due-to="Simo385">
Update SocketClient default connect timeout from ∞ to 60 seconds #51.
</action>
+ <action issue="NET-695" type="update" dev="ggregory" due-to="Gary Gregory, Possibly Cott">
+ Apply SocketClient timeout after connection but before SSL negotiation.
+ </action>
</release>
<release version="3.7.1" date="2020-09-30" description="Maintenance and bug fix release.">
<action issue="NET-687" type="fix" dev="ggregory" due-to="Gary Gregory, Mikael, j-verse">
diff --git a/src/main/java/org/apache/commons/net/SocketClient.java b/src/main/java/org/apache/commons/net/SocketClient.java
index 8e79ca9..492b59a 100644
--- a/src/main/java/org/apache/commons/net/SocketClient.java
+++ b/src/main/java/org/apache/commons/net/SocketClient.java
@@ -155,12 +155,17 @@ public abstract class SocketClient
*/
protected void _connectAction_() throws IOException
{
- _socket_.setSoTimeout(_timeout_);
+ applySocketAttributes();
_input_ = _socket_.getInputStream();
_output_ = _socket_.getOutputStream();
}
+ protected void applySocketAttributes() throws SocketException {
+ _socket_.setSoTimeout(_timeout_);
+ }
+
+
/**
* Opens a Socket connected to a remote host at the specified port and
* originating from the current host at a system assigned port.
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
index c704f16..06f3d1f 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
@@ -215,6 +215,7 @@ public class FTPSClient extends FTPClient {
protected void _connectAction_() throws IOException {
// Implicit mode.
if (isImplicit) {
+ applySocketAttributes();
sslNegotiation();
}
super._connectAction_();
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3SClient.java b/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
index b7187b8..f223f92 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
@@ -178,6 +178,7 @@ public class POP3SClient extends POP3Client
{
// Implicit mode.
if (isImplicit) {
+ applySocketAttributes();
performSSLNegotiation();
}
super._connectAction_();
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java b/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
index 3781473..c1c66f8 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
@@ -168,6 +168,7 @@ public class SMTPSClient extends SMTPClient
{
// Implicit mode.
if (isImplicit) {
+ applySocketAttributes();
performSSLNegotiation();
}
super._connectAction_();