diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-05-08 00:14:33 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-05-08 14:10:44 +0200 |
commit | 39a33fcac0e4530ef0c60d3319504e078ea2f137 (patch) | |
tree | c517936e7c16271498e8fafc8de2c74202ad73b9 /src | |
parent | fb7886b9c95009a837f584caf4943a455f3daa60 (diff) | |
download | curl-39a33fcac0e4530ef0c60d3319504e078ea2f137.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_operate.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 06ae39396..4da9dea16 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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; |