mirror of
https://github.com/curl/curl.git
synced 2026-06-04 12:54:15 +03:00
tool_operate: refuse (--data or --form) and --continue-at combo
libcurl assumes that a --continue-at resumption is done to continue an upload using the read callback and neither --data nor --form use that and thus won't do what the user wants. Whatever the user wants with this strange combination. Add test 426 to verify. Reported-by: Smackd0wn on github Fixes #11081 Closes #11083
This commit is contained in:
parent
fb7886b9c9
commit
39a33fcac0
3 changed files with 54 additions and 9 deletions
|
|
@ -1398,19 +1398,30 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||
|
||||
switch(config->httpreq) {
|
||||
case HTTPREQ_SIMPLEPOST:
|
||||
my_setopt_str(curl, CURLOPT_POSTFIELDS,
|
||||
config->postfields);
|
||||
my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE,
|
||||
config->postfieldsize);
|
||||
if(config->resume_from) {
|
||||
errorf(global, "cannot mix --continue-at with --data\n");
|
||||
result = CURLE_FAILED_INIT;
|
||||
}
|
||||
else {
|
||||
my_setopt_str(curl, CURLOPT_POSTFIELDS,
|
||||
config->postfields);
|
||||
my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE,
|
||||
config->postfieldsize);
|
||||
}
|
||||
break;
|
||||
case HTTPREQ_MIMEPOST:
|
||||
/* free previous remainders */
|
||||
curl_mime_free(config->mimepost);
|
||||
config->mimepost = NULL;
|
||||
result = tool2curlmime(curl, config->mimeroot, &config->mimepost);
|
||||
if(result)
|
||||
break;
|
||||
my_setopt_mimepost(curl, CURLOPT_MIMEPOST, config->mimepost);
|
||||
if(config->resume_from) {
|
||||
errorf(global, "cannot mix --continue-at with --form\n");
|
||||
result = CURLE_FAILED_INIT;
|
||||
}
|
||||
else {
|
||||
result = tool2curlmime(curl, config->mimeroot, &config->mimepost);
|
||||
if(!result)
|
||||
my_setopt_mimepost(curl, CURLOPT_MIMEPOST, config->mimepost);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue