mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:23:31 +03:00
lib: unify the upload/method handling
By making sure we set state.upload based on the set.method value and not independently as set.upload, we reduce confusion and mixup risks, both internally and externally. Closes #11017
This commit is contained in:
parent
e5af5b7905
commit
7815647d65
15 changed files with 36 additions and 38 deletions
|
|
@ -1209,7 +1209,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
|
||||
case SSH_SFTP_TRANS_INIT:
|
||||
if(data->set.upload)
|
||||
if(data->state.upload)
|
||||
state(data, SSH_SFTP_UPLOAD_INIT);
|
||||
else {
|
||||
if(protop->path[strlen(protop->path)-1] == '/')
|
||||
|
|
@ -1802,7 +1802,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
/* Functions from the SCP subsystem cannot handle/return SSH_AGAIN */
|
||||
ssh_set_blocking(sshc->ssh_session, 1);
|
||||
|
||||
if(data->set.upload) {
|
||||
if(data->state.upload) {
|
||||
if(data->state.infilesize < 0) {
|
||||
failf(data, "SCP requires a known file size for upload");
|
||||
sshc->actualcode = CURLE_UPLOAD_FAILED;
|
||||
|
|
@ -1907,7 +1907,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
break;
|
||||
}
|
||||
case SSH_SCP_DONE:
|
||||
if(data->set.upload)
|
||||
if(data->state.upload)
|
||||
state(data, SSH_SCP_SEND_EOF);
|
||||
else
|
||||
state(data, SSH_SCP_CHANNEL_FREE);
|
||||
|
|
|
|||
|
|
@ -2019,7 +2019,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
|
||||
case SSH_SFTP_TRANS_INIT:
|
||||
if(data->set.upload)
|
||||
if(data->state.upload)
|
||||
state(data, SSH_SFTP_UPLOAD_INIT);
|
||||
else {
|
||||
if(sshp->path[strlen(sshp->path)-1] == '/')
|
||||
|
|
@ -2691,7 +2691,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
break;
|
||||
}
|
||||
|
||||
if(data->set.upload) {
|
||||
if(data->state.upload) {
|
||||
if(data->state.infilesize < 0) {
|
||||
failf(data, "SCP requires a known file size for upload");
|
||||
sshc->actualcode = CURLE_UPLOAD_FAILED;
|
||||
|
|
@ -2831,7 +2831,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
break;
|
||||
|
||||
case SSH_SCP_DONE:
|
||||
if(data->set.upload)
|
||||
if(data->state.upload)
|
||||
state(data, SSH_SCP_SEND_EOF);
|
||||
else
|
||||
state(data, SSH_SCP_CHANNEL_FREE);
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||
}
|
||||
break;
|
||||
case SSH_SFTP_TRANS_INIT:
|
||||
if(data->set.upload)
|
||||
if(data->state.upload)
|
||||
state(data, SSH_SFTP_UPLOAD_INIT);
|
||||
else {
|
||||
if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue