mirror of
https://github.com/curl/curl.git
synced 2026-08-24 19:53:46 +03:00
lib: xfer_setup simplify
Make variants for transfers that send/receive or do both with just the parameters they need. Split out the shutdown setting into a separate function. Only FTP bothers with that. Closes #18203
This commit is contained in:
parent
034612cd51
commit
6cebd35b4c
15 changed files with 104 additions and 109 deletions
|
|
@ -1251,7 +1251,7 @@ static int myssh_in_UPLOAD_INIT(struct Curl_easy *data,
|
|||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
}
|
||||
/* upload data */
|
||||
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
|
@ -1423,7 +1423,7 @@ static int myssh_in_SFTP_DOWNLOAD_STAT(struct Curl_easy *data,
|
|||
myssh_to(data, sshc, SSH_STOP);
|
||||
return rc;
|
||||
}
|
||||
Curl_xfer_setup1(data, CURL_XFER_RECV, data->req.size, FALSE);
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, data->req.size, FALSE);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->send_idx = 0;
|
||||
|
|
@ -2240,7 +2240,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/* upload data */
|
||||
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
|
@ -2279,7 +2279,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data,
|
|||
/* download data */
|
||||
bytecount = ssh_scp_request_get_size(sshc->scp_session);
|
||||
data->req.maxdownload = (curl_off_t) bytecount;
|
||||
Curl_xfer_setup1(data, CURL_XFER_RECV, bytecount, FALSE);
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, bytecount, FALSE);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
conn->send_idx = 0;
|
||||
|
|
|
|||
|
|
@ -1199,7 +1199,7 @@ sftp_upload_init(struct Curl_easy *data,
|
|||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
}
|
||||
/* upload data */
|
||||
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
|
@ -1540,7 +1540,7 @@ sftp_download_stat(struct Curl_easy *data,
|
|||
myssh_state(data, sshc, SSH_STOP);
|
||||
return CURLE_OK;
|
||||
}
|
||||
Curl_xfer_setup1(data, CURL_XFER_RECV, data->req.size, FALSE);
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, data->req.size, FALSE);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->send_idx = 0;
|
||||
|
|
@ -2460,7 +2460,7 @@ static CURLcode ssh_state_scp_download_init(struct Curl_easy *data,
|
|||
/* download data */
|
||||
bytecount = (curl_off_t)sb.st_size;
|
||||
data->req.maxdownload = (curl_off_t)sb.st_size;
|
||||
Curl_xfer_setup1(data, CURL_XFER_RECV, bytecount, FALSE);
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, bytecount, FALSE);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->send_idx = 0;
|
||||
|
|
@ -2609,7 +2609,7 @@ static CURLcode ssh_state_scp_upload_init(struct Curl_easy *data,
|
|||
/* upload data */
|
||||
data->req.size = data->state.infilesize;
|
||||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
|
|
|||
|
|
@ -717,7 +717,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
|
|||
Curl_pgrsSetUploadSize(data, data->state.infilesize);
|
||||
}
|
||||
/* upload data */
|
||||
Curl_xfer_setup1(data, CURL_XFER_SEND, -1, FALSE);
|
||||
Curl_xfer_setup_send(data, FIRSTSOCKET);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
data->conn->recv_idx = FIRSTSOCKET;
|
||||
|
|
@ -816,7 +816,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data,
|
|||
wssh_state(data, sshc, SSH_STOP);
|
||||
break;
|
||||
}
|
||||
Curl_xfer_setup1(data, CURL_XFER_RECV, data->req.size, FALSE);
|
||||
Curl_xfer_setup_recv(data, FIRSTSOCKET, data->req.size, FALSE);
|
||||
|
||||
/* not set by Curl_xfer_setup to preserve keepon bits */
|
||||
conn->send_idx = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue