aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ssh.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 9838c9579..80906d814 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -1568,9 +1568,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(data->set.upload)
state(conn, SSH_SFTP_UPLOAD_INIT);
else {
- if(data->set.opt_no_body)
- state(conn, SSH_STOP);
- else if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
+ if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
state(conn, SSH_SFTP_READDIR_INIT);
else
state(conn, SSH_SFTP_DOWNLOAD_INIT);
@@ -1808,6 +1806,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
case SSH_SFTP_READDIR_INIT:
+ Curl_pgrsSetDownloadSize(data, -1);
+ if(data->set.opt_no_body)
+ state(conn, SSH_STOP);
+
/*
* This is a directory that we are trying to get, so produce a directory
* listing
@@ -2065,6 +2067,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
data->req.size = -1;
data->req.maxdownload = -1;
+ Curl_pgrsSetDownloadSize(data, -1);
}
else {
curl_off_t size = attrs.filesize;
@@ -2142,6 +2145,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
}
}
+
+ if(data->set.opt_no_body)
+ state(conn, SSH_SFTP_CLOSE);
+
/* Setup the actual download */
if(data->req.size == 0) {
/* no data to transfer */