On Friday 28 of August 2009 00:10:45 Daniel Stenberg wrote:
> On Mon, 24 Aug 2009, Kamil Dudka wrote:
> > What about the attached patch? It solves the problem for me, not sure if
> > that way is libcurl is supposed to work...
>
> Not bad, not bad at all. But I didn't like the #ifdefs and the second
> socket handling for the ssh transfers could be made better. How about this
> updated version (based on yours) ?
Thanks for being patient. I don't like #ifdefs, too. We should avoid it as
much as possible. Some notes inline the incremental patch:
> diff -rup curl.k/lib/ssh.c curl.d/lib/ssh.c
> --- curl.k/lib/ssh.c 2009-08-28 00:18:04.383590721 +0200
> +++ curl.d/lib/ssh.c 2009-08-28 00:18:31.550591905 +0200
> @@ -1500,7 +1500,7 @@ static CURLcode ssh_statemach_act(struct
> Curl_pgrsSetUploadSize(data, data->set.infilesize);
> }
> /* upload data */
> - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL,
> + result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL,
> FIRSTSOCKET, NULL);
>
> if(result) {
This breaks SFTP upload completely:
...
* Initialized SSH public key authentication
* Authentication complete
* Closing connection #0
* Failure when receiving data from the peer
> diff -rup curl.k/lib/transfer.c curl.d/lib/transfer.c
> --- curl.k/lib/transfer.c 2009-08-28 00:18:04.383590721 +0200
> +++ curl.d/lib/transfer.c 2009-08-28 00:18:31.554611830 +0200
> @@ -1652,10 +1652,6 @@ CURLcode Curl_readwrite(struct connectda
>
> if((k->keepon & KEEP_RECVBITS) == KEEP_RECV) {
> fd_read = conn->sockfd;
> -#if defined(USE_LIBSSH2)
> - if(conn->protocol & (PROT_SCP|PROT_SFTP))
> - select_res |= CURL_CSELECT_IN;
> -#endif /* USE_LIBSSH2 */
> } else
> fd_read = CURL_SOCKET_BAD;
This breaks SFTP *download*. Anyway it deserves a comment:
1) Why has been the exception here?
2) Why are you going to drop it right now?
Kamil