diff options
author | Howard Chu <hyc@highlandsun.com> | 2010-05-11 22:48:38 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-05-11 22:48:38 +0200 |
commit | bc8fc9803fbd0fa9daf0dba796d42d03faf49120 (patch) | |
tree | edd313accc3ad85ef2b4826f5ffa9e335da86ebd /lib | |
parent | 016ce4b1daa0f8d44a0da7105e1e1c97531e8b87 (diff) |
sendrecv: make them two pairs of send/recv to properly deal with FTPS
FTP(S) use two connections that can be set to different recv and
send functions independently, so by introducing recv+send pairs
in the same manner we already have sockets/connections we can
work with FTPS fine.
This commit fixes the FTPS regression introduced in change d64bd82.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gtls.c | 4 | ||||
-rw-r--r-- | lib/nss.c | 4 | ||||
-rw-r--r-- | lib/polarssl.c | 4 | ||||
-rw-r--r-- | lib/qssl.c | 4 | ||||
-rw-r--r-- | lib/security.c | 6 | ||||
-rw-r--r-- | lib/sendf.c | 4 | ||||
-rw-r--r-- | lib/ssh.c | 8 | ||||
-rw-r--r-- | lib/ssluse.c | 4 | ||||
-rw-r--r-- | lib/url.c | 6 | ||||
-rw-r--r-- | lib/urldata.h | 4 |
10 files changed, 26 insertions, 22 deletions
diff --git a/lib/gtls.c b/lib/gtls.c index 2cb1fae41..99be073a0 100644 --- a/lib/gtls.c +++ b/lib/gtls.c @@ -633,8 +633,8 @@ gtls_connect_step3(struct connectdata *conn, infof(data, "\t MAC: %s\n", ptr); conn->ssl[sockindex].state = ssl_connection_complete; - conn->recv = gtls_recv; - conn->send = gtls_send; + conn->recv[sockindex] = gtls_recv; + conn->send[sockindex] = gtls_send; { /* we always unconditionally get the session id here, as even if we @@ -1339,8 +1339,8 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) } connssl->state = ssl_connection_complete; - conn->recv = nss_recv; - conn->send = nss_send; + conn->recv[sockindex] = nss_recv; + conn->send[sockindex] = nss_send; display_conn_info(conn, connssl->handle); diff --git a/lib/polarssl.c b/lib/polarssl.c index 0027e31e0..285b3ae04 100644 --- a/lib/polarssl.c +++ b/lib/polarssl.c @@ -302,8 +302,8 @@ Curl_polarssl_connect(struct connectdata *conn, } conn->ssl[sockindex].state = ssl_connection_complete; - conn->recv = polarssl_recv; - conn->send = polarssl_send; + conn->recv[sockindex] = polarssl_recv; + conn->send[sockindex] = polarssl_send; /* Save the current session data for possible re-use */ { diff --git a/lib/qssl.c b/lib/qssl.c index 74f9b5766..dd4f911d1 100644 --- a/lib/qssl.c +++ b/lib/qssl.c @@ -268,8 +268,8 @@ CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex) } if (rc == CURLE_OK) { connssl->state = ssl_connection_complete; - conn->recv = qsossl_recv; - conn->send = qsossl_send; + conn->recv[sockindex] = qsossl_recv; + conn->send[sockindex] = qsossl_send; } return rc; diff --git a/lib/security.c b/lib/security.c index 03b1be251..eceb013b5 100644 --- a/lib/security.c +++ b/lib/security.c @@ -466,8 +466,10 @@ Curl_sec_login(struct connectdata *conn) conn->mech = *m; conn->sec_complete = 1; if (conn->data_prot != prot_clear) { - conn->recv = sec_read; - conn->send = _sec_send; + conn->recv[FIRSTSOCKET] = sec_read; + conn->send[FIRSTSOCKET] = _sec_send; + conn->recv[SECONDARYSOCKET] = sec_read; + conn->send[SECONDARYSOCKET] = _sec_send; } conn->command_prot = prot_safe; /* Set the requested protection level */ diff --git a/lib/sendf.c b/lib/sendf.c index ffd01c744..94bcb9c78 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -251,7 +251,7 @@ CURLcode Curl_write(struct connectdata *conn, CURLcode curlcode = CURLE_OK; int num = (sockfd == conn->sock[SECONDARYSOCKET]); - bytes_written = conn->send(conn, num, mem, len, &curlcode); + bytes_written = conn->send[num](conn, num, mem, len, &curlcode); *written = bytes_written; if(-1 != bytes_written) @@ -576,7 +576,7 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */ buffertofill = buf; } - nread = conn->recv(conn, num, buffertofill, bytesfromsocket, &curlcode); + nread = conn->recv[num](conn, num, buffertofill, bytesfromsocket, &curlcode); if(nread == -1) return curlcode; @@ -2493,11 +2493,11 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done) return result; if(conn->protocol & PROT_SCP) { - conn->recv = scp_recv; - conn->send = scp_send; + conn->recv[FIRSTSOCKET] = scp_recv; + conn->send[FIRSTSOCKET] = scp_send; } else { - conn->recv = sftp_recv; - conn->send = sftp_send; + conn->recv[FIRSTSOCKET] = sftp_recv; + conn->send[FIRSTSOCKET] = sftp_send; } ssh = &conn->proto.sshc; diff --git a/lib/ssluse.c b/lib/ssluse.c index 0e23c0842..ce62605e8 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -2440,8 +2440,8 @@ ossl_connect_common(struct connectdata *conn, if(ssl_connect_done==connssl->connecting_state) { connssl->state = ssl_connection_complete; - conn->recv = ossl_recv; - conn->send = ossl_send; + conn->recv[sockindex] = ossl_recv; + conn->send[sockindex] = ossl_send; *done = TRUE; } else @@ -4754,8 +4754,10 @@ static CURLcode create_conn(struct SessionHandle *data, return result; } - conn->recv = Curl_recv_plain; - conn->send = Curl_send_plain; + conn->recv[FIRSTSOCKET] = Curl_recv_plain; + conn->send[FIRSTSOCKET] = Curl_send_plain; + conn->recv[SECONDARYSOCKET] = Curl_recv_plain; + conn->send[SECONDARYSOCKET] = Curl_send_plain; /*********************************************************************** * file: is a special case in that it doesn't need a network connection diff --git a/lib/urldata.h b/lib/urldata.h index efc56d7b0..30782c2a2 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -760,8 +760,8 @@ struct connectdata { curl_socket_t sock[2]; /* two sockets, the second is used for the data transfer when doing FTP */ - Curl_recv *recv; - Curl_send *send; + Curl_recv *recv[2]; + Curl_send *send[2]; struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */ struct ssl_config_data ssl_config; |