-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Description
When calling curl_easy_perform() more than once on one easy handle for a SSH connection (sftp:// URL), the connection is not reused. See example code below.
It seems to try reusing the connection, but then says that the connection is dead. See excerpt from the output of my example program below.
curl/libcurl version
Compiled curl on Debian GNU/Linux:
curl 7.64.0-DEV (x86_64-pc-linux-gnu) libcurl/7.64.0-DEV OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.0.5 libssh/0.8.6/openssl/zlib
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS Debug TrackMemory IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy
Same on Windows with CURL 7.63.0 on Windows 7, compiled with Visual Studio 2017 and libssh 0.8.6
tested operating systems
- Debian GNU/Linux sid
- Windows 7
example program source code
#include <assert.h>
#include <stdio.h>
#include <curl/curl.h>
int main()
{
CURLcode status = curl_global_init(CURL_GLOBAL_ALL);
assert(CURLE_OK == status);
CURL* curl = curl_easy_init();
assert(curl);
status = curl_easy_setopt(curl, CURLOPT_URL, "sftp://localhost/~/");
assert(CURLE_OK == status);
status = curl_easy_setopt(curl, CURLOPT_VERBOSE, (long) 1);
assert(CURLE_OK == status);
status = curl_easy_perform(curl);
assert(CURLE_OK == status);
puts("\n\nSecond curl_easy_perform() call...\n\n");
status = curl_easy_perform(curl);
assert(CURLE_OK == status);
curl_global_cleanup();
return 0;
}excerpt from the output of the example program
...
* SFTP DONE done
* SSH 0x556ccafe29c0 state change from SSH_SFTP_CLOSE to SSH_STOP (line 1651)
* Connection #0 to host localhost left intact
* Expire cleared (transfer 0x556ccafe41a8)
Second curl_easy_perform() call...
* Expire in 0 ms for 6 (transfer 0x556ccafe41a8)
* STATE: INIT => CONNECT handle 0x556ccafe41a8; line 1443 (connection #-5000)
* Found bundle for host localhost: 0x556ccafe0418 [serially]
* Connection 0 seems to be dead!
* The cache now contains 0 members
* SSH DISCONNECT starts now
...
Reactions are currently unavailable