diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2023-04-26 09:44:57 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-05-15 13:20:47 +0200 |
commit | e915b6904c02294dc5ccd9b7c95d46af2839dd1c (patch) | |
tree | a4abacc77e8c530b19971e7db3ac74bc96b24f21 /lib | |
parent | f157610d30e981b2f5553c0f212adfdc75881ab5 (diff) | |
download | curl-e915b6904c02294dc5ccd9b7c95d46af2839dd1c.tar.gz |
ssh: Add support for libssh2 read timeout
Hook the new (1.11.0 or newer) libssh2 support for setting a read timeout
into the SERVER_RESPONSE_TIMEOUT option. With this done, clients can use
the standard curl response timeout setting to also control the time that
libssh2 will wait for packets from a slow server. This is necessary to
enable use of very slow SFTP servers.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Closes #10965
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vssh/libssh2.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index dd39a844c..14c2784fe 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -3280,6 +3280,16 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done) return CURLE_FAILED_INIT; } +#ifdef HAVE_LIBSSH2_VERSION + /* Set the packet read timeout if the libssh2 version supports it */ +#if LIBSSH2_VERSION_NUM >= 0x010B00 + if(data->set.server_response_timeout > 0) { + libssh2_session_set_read_timeout(sshc->ssh_session, + data->set.server_response_timeout / 1000); + } +#endif +#endif + #ifndef CURL_DISABLE_PROXY if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) { /* |