mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
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
.
This commit is contained in:
parent
016ce4b1da
commit
bc8fc9803f
@ -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);
|
||||
|
||||
|
@ -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 */
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user