curl/backport-transfer-refuse-POSTFIELDS-RESUME_FROM-combo.patch
sherlock2010 fd9fed8b41 backport some patches from community
(cherry picked from commit 8afd3b243da43e6602d4780fa0312fc72c31449d)
2024-01-04 19:08:04 +08:00

43 lines
1.2 KiB
Diff

From fb7886b9c95009a837f584caf4943a455f3daa60 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 8 May 2023 00:12:25 +0200
Subject: [PATCH] transfer: refuse POSTFIELDS + RESUME_FROM combo
The code assumes that such a resume is wanting to continue an upload
using the read callback, and since POSTFIELDS is done without callback
libcurl will just misbehave.
This combo will make the transfer fail with CURLE_BAD_FUNCTION_ARGUMENT
with an explanation in the error message.
Reported-by: Smackd0wn on github
Fixes #11081
Closes #11083
Conflict: NA
Reference: https://github.com/curl/curl/commit/fb7886b9c95009a837f584caf4943a455f3daa60
---
lib/transfer.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/transfer.c b/lib/transfer.c
index 947070956..d2ff0c24c 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1325,6 +1325,12 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
}
}
+ if(data->set.postfields && data->set.set_resume_from) {
+ /* we can't */
+ failf(data, "cannot mix POSTFIELDS with RESUME_FROM");
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ }
+
data->state.prefer_ascii = data->set.prefer_ascii;
data->state.list_only = data->set.list_only;
data->state.httpreq = data->set.method;
--
2.33.0