aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Byron <dbyron@dbyron.com>2015-07-20 20:27:12 -0700
committerDaniel Stenberg <daniel@haxx.se>2016-02-14 11:03:07 +0100
commitcae21ffc1652ad78bceb6d9f419e39a08efc4d8d (patch)
treec10515aec8ff2cdb839ef21e9f02a0dd8a83a5db /lib
parent078753c40d05fc4a07ee20a18f60fc325592b31c (diff)
SCP: use libssh2_scp_recv2 to support > 2GB files on windows
libssh2_scp_recv2 is introduced in libssh2 1.7.0 - to be released "any day now. Closes #451
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 10bf54639..e63446bed 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2371,19 +2371,30 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
case SSH_SCP_DOWNLOAD_INIT:
{
+ curl_off_t bytecount;
+
/*
* We must check the remote file; if it is a directory no values will
* be set in sb
*/
- struct stat sb;
- curl_off_t bytecount;
- /* clear the struct scp recv will fill in */
- memset(&sb, 0, sizeof(struct stat));
+ /*
+ * If support for >2GB files exists, use it.
+ */
/* get a fresh new channel from the ssh layer */
+#if LIBSSH2_VERSION_NUM < 0x010700
+ struct stat sb;
+ memset(&sb, 0, sizeof(struct stat));
sshc->ssh_channel = libssh2_scp_recv(sshc->ssh_session,
sftp_scp->path, &sb);
+#else
+ libssh2_struct_stat sb;
+ memset(&sb, 0, sizeof(libssh2_struct_stat));
+ sshc->ssh_channel = libssh2_scp_recv2(sshc->ssh_session,
+ sftp_scp->path, &sb);
+#endif
+
if(!sshc->ssh_channel) {
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {