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.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 { public static final List DEFAULT_CHANNEL_FACTORIES = Collections.unmodifiableList(Collections.singletonList(ForwardedTcpipFactory.INSTANCE)); public static final List> DEFAULT_GLOBAL_REQUEST_HANDLERS - = Collections.unmodifiableList(Collections.singletonList(OpenSshHostKeysHandler.INSTANCE)); + = Collections.unmodifiableList( + Arrays.> 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.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.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;