aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-12-22 13:12:36 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-12-22 13:12:36 +0000
commit7ffe62d9019a3e1749bd90f23c4bab15657d6cd7 (patch)
treead802a92b7118dbe318b17e6bb195f0ccfb468d2 /lib/ssh.c
parentd5bfec70af0d53eed164c9fdec142ebe8fe5c81d (diff)
- Given a recent enough libssh2, libcurl can now seek/resume with SFTP even
on file indexes beyond 2 or 4GB.
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index c1aa48fd9..339c2db2a 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -432,6 +432,16 @@ static CURLcode ssh_getworkingpath(struct connectdata *conn,
}
/*
+ * Earlier libssh2 versions didn't have the ability to seek to 64bit positions
+ * with 32bit size_t.
+ */
+#ifdef HAVE_LIBSSH2_SFTP_SEEK2
+#define SFTP_SEEK(x,y) libssh2_sftp_seek2(x, (libssh2_uint64_t)y)
+#else
+#define SFTP_SEEK(x,y) libssh2_sftp_seek(x, y)
+#endif
+
+/*
* ssh_statemach_act() runs the SSH statemachine "one round" and returns. The
* data the pointer 'block' points to will be set to TRUE if the libssh2
* function returns LIBSSH2_ERROR_EAGAIN meaning it wants to be called again
@@ -1343,7 +1353,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_pgrsSetUploadSize(data, data->set.infilesize);
}
- libssh2_sftp_seek(sshc->sftp_handle, data->state.resume_from);
+ SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
}
if(data->set.infilesize>0) {
data->req.size = data->set.infilesize;
@@ -1716,7 +1726,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
size = to - from + 1;
}
- libssh2_sftp_seek(conn->proto.sshc.sftp_handle, from);
+ SFTP_SEEK(conn->proto.sshc.sftp_handle, from);
}
data->req.size = size;
data->req.maxdownload = size;
@@ -1750,7 +1760,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
data->req.maxdownload = attrs.filesize - data->state.resume_from;
Curl_pgrsSetDownloadSize(data,
attrs.filesize - data->state.resume_from);
- libssh2_sftp_seek(sshc->sftp_handle, data->state.resume_from);
+ SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
}
}
/* Setup the actual download */