Loading lib/sendf.c +13 −7 Original line number Diff line number Diff line Loading @@ -516,13 +516,19 @@ int Curl_read(struct connectdata *conn, /* connection data */ } } #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) { else if (conn->protocol & (PROT_SCP|PROT_SFTP)) { if(conn->protocol & PROT_SCP) nread = Curl_scp_recv(conn, num, buffertofill, bytesfromsocket); /* TODO: return CURLE_OK also for nread <= 0 read failures and timeouts ? */ } else if (conn->protocol & PROT_SFTP) { else if (conn->protocol & PROT_SFTP) nread = Curl_sftp_recv(conn, num, buffertofill, bytesfromsocket); #ifdef LIBSSH2CHANNEL_EAGAIN if((nread == LIBSSH2CHANNEL_EAGAIN) || (nread == 0)) /* EWOULDBLOCK */ return -1; #endif if(nread < 0) /* since it is negative and not EGAIN, it was a protocol-layer error */ return CURLE_RECV_ERROR; } #endif /* !USE_LIBSSH2 */ else { Loading lib/ssh.c +9 −2 Original line number Diff line number Diff line Loading @@ -630,6 +630,7 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, char *mem, size_t len) { ssize_t nread; (void)sockindex; /* we only support SCP on the fixed known primary socket */ /* libssh2_channel_read() returns int * Loading @@ -637,10 +638,16 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, * in the SessionHandle struct */ #ifdef LIBSSH2CHANNEL_EAGAIN /* we prefer the non-blocking API but that didn't exist previously */ nread = (ssize_t) libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel, mem, len); #else nread = (ssize_t) libssh2_channel_read(conn->data->reqdata.proto.ssh->ssh_channel, mem, len); (void)sockindex; #endif return nread; } Loading Loading
lib/sendf.c +13 −7 Original line number Diff line number Diff line Loading @@ -516,13 +516,19 @@ int Curl_read(struct connectdata *conn, /* connection data */ } } #ifdef USE_LIBSSH2 else if (conn->protocol & PROT_SCP) { else if (conn->protocol & (PROT_SCP|PROT_SFTP)) { if(conn->protocol & PROT_SCP) nread = Curl_scp_recv(conn, num, buffertofill, bytesfromsocket); /* TODO: return CURLE_OK also for nread <= 0 read failures and timeouts ? */ } else if (conn->protocol & PROT_SFTP) { else if (conn->protocol & PROT_SFTP) nread = Curl_sftp_recv(conn, num, buffertofill, bytesfromsocket); #ifdef LIBSSH2CHANNEL_EAGAIN if((nread == LIBSSH2CHANNEL_EAGAIN) || (nread == 0)) /* EWOULDBLOCK */ return -1; #endif if(nread < 0) /* since it is negative and not EGAIN, it was a protocol-layer error */ return CURLE_RECV_ERROR; } #endif /* !USE_LIBSSH2 */ else { Loading
lib/ssh.c +9 −2 Original line number Diff line number Diff line Loading @@ -630,6 +630,7 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, char *mem, size_t len) { ssize_t nread; (void)sockindex; /* we only support SCP on the fixed known primary socket */ /* libssh2_channel_read() returns int * Loading @@ -637,10 +638,16 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, * in the SessionHandle struct */ #ifdef LIBSSH2CHANNEL_EAGAIN /* we prefer the non-blocking API but that didn't exist previously */ nread = (ssize_t) libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel, mem, len); #else nread = (ssize_t) libssh2_channel_read(conn->data->reqdata.proto.ssh->ssh_channel, mem, len); (void)sockindex; #endif return nread; } Loading