This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git


The following commit(s) were added to refs/heads/master by this push:
     new d12e0527e [SSHD-1330] Using common keep-alive global request handler 
in client as well as server
     new 128351525 Merge pull request #416 from lgoldstein/SSHD-1330
d12e0527e is described below

commit d12e0527eef64c9040b4efb4ec232f3ec4c7467f
Author: Lyor Goldstein <lgoldst...@apache.org>
AuthorDate: Mon Sep 18 20:17:31 2023 +0300

    [SSHD-1330] Using common keep-alive global request handler in client as 
well as server
---
 CHANGES.md                                                         | 7 +++++++
 sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java  | 6 +++++-
 .../apache/sshd/{server => common}/global/KeepAliveHandler.java    | 2 +-
 sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java  | 2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3b1d228f4..aae82ad34 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -45,6 +45,7 @@
 
 ## New Features
 
+* [SSHD-1330](https://issues.apache.org/jira/browse/SSHD-1330) Use 
`KeepAliveHandler` global request instance in client as well
 * [GH-356](https://github.com/apache/mina-sshd/issues/356) Publish snapshot 
maven artifacts to the [Apache 
Snapshots](https://repository.apache.org/content/repositories/snapshots) maven 
repository.
 * Bundle _sshd-contrib_ has support classes for the [HAProxy protocol 
V2](https://www.haproxy.org/download/2.7/doc/proxy-protocol.txt).
 
@@ -69,6 +70,12 @@ actual data transfer, it also completely avoids the WS_FTP 
bug mentioned in
 
 ## Potential compatibility issues
 
+### `KeepAliveHandler` global request handler moved from server to common 
global requests package
+
+Was previously only on server-side - now also for client (see 
[SSHD-1330](https://issues.apache.org/jira/browse/SSHD-1330)).
+This should be fully backward compatible since most servers do not send this 
request. However, if users have somehow added this
+handler to the client side independently, the code should be re-examined and 
the independent handler removed or make it replace the global one.
+
 ### Server-side SFTP file handle encoding
 
 The aforementioned fix for the size of SFTP file handles has the potential to
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java 
b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
index 7ee11adce..c7308bdea 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/ClientBuilder.java
@@ -19,6 +19,7 @@
 
 package org.apache.sshd.client;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Function;
@@ -39,6 +40,7 @@ import org.apache.sshd.common.compression.BuiltinCompressions;
 import org.apache.sshd.common.compression.Compression;
 import org.apache.sshd.common.compression.CompressionFactory;
 import org.apache.sshd.common.config.keys.FilePasswordProvider;
+import org.apache.sshd.common.global.KeepAliveHandler;
 import org.apache.sshd.common.kex.DHFactory;
 import org.apache.sshd.common.kex.KeyExchange;
 import org.apache.sshd.common.kex.KeyExchangeFactory;
@@ -67,7 +69,9 @@ public class ClientBuilder extends BaseBuilder<SshClient, 
ClientBuilder> {
     public static final List<ChannelFactory> DEFAULT_CHANNEL_FACTORIES
             = 
Collections.unmodifiableList(Collections.singletonList(ForwardedTcpipFactory.INSTANCE));
     public static final List<RequestHandler<ConnectionService>> 
DEFAULT_GLOBAL_REQUEST_HANDLERS
-            = 
Collections.unmodifiableList(Collections.singletonList(OpenSshHostKeysHandler.INSTANCE));
+            = Collections.unmodifiableList(
+                    Arrays.<RequestHandler<ConnectionService>> 
asList(OpenSshHostKeysHandler.INSTANCE,
+                            KeepAliveHandler.INSTANCE));
 
     public static final ServerKeyVerifier DEFAULT_SERVER_KEY_VERIFIER = 
AcceptAllServerKeyVerifier.INSTANCE;
     public static final HostConfigEntryResolver 
DEFAULT_HOST_CONFIG_ENTRY_RESOLVER
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/global/KeepAliveHandler.java 
b/sshd-core/src/main/java/org/apache/sshd/common/global/KeepAliveHandler.java
similarity index 98%
rename from 
sshd-core/src/main/java/org/apache/sshd/server/global/KeepAliveHandler.java
rename to 
sshd-core/src/main/java/org/apache/sshd/common/global/KeepAliveHandler.java
index 0b672830e..d3166702d 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/global/KeepAliveHandler.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/global/KeepAliveHandler.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sshd.server.global;
+package org.apache.sshd.common.global;
 
 import org.apache.sshd.common.SshConstants;
 import org.apache.sshd.common.session.ConnectionService;
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java 
b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
index bdc1702b7..4fe4961e3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerBuilder.java
@@ -31,6 +31,7 @@ import org.apache.sshd.common.channel.RequestHandler;
 import org.apache.sshd.common.compression.BuiltinCompressions;
 import org.apache.sshd.common.compression.Compression;
 import org.apache.sshd.common.compression.CompressionFactory;
+import org.apache.sshd.common.global.KeepAliveHandler;
 import org.apache.sshd.common.kex.DHFactory;
 import org.apache.sshd.common.kex.KeyExchange;
 import org.apache.sshd.common.kex.KeyExchangeFactory;
@@ -45,7 +46,6 @@ import org.apache.sshd.server.channel.ChannelSessionFactory;
 import org.apache.sshd.server.config.keys.DefaultAuthorizedKeysAuthenticator;
 import org.apache.sshd.server.forward.DirectTcpipFactory;
 import org.apache.sshd.server.global.CancelTcpipForwardHandler;
-import org.apache.sshd.server.global.KeepAliveHandler;
 import org.apache.sshd.server.global.NoMoreSessionsHandler;
 import org.apache.sshd.server.global.OpenSshHostKeysHandler;
 import org.apache.sshd.server.global.TcpipForwardHandler;

Reply via email to