[PATCH v2 5/5] http: reset CURLOPT_POSTFIELDSIZE_LARGE between requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`get_active_slot()` makes sure that the reused cURL handles it gives
out are as good as fresh ones, by resetting all options that other code
might have set on them back to defaults.

But this does not apply to `CURLOPT_POSTFIELDSIZE_LARGE` yet, which can
stay set from a previous request. For example, an earlier probe request
with just a flush packet "0000" leaves it set to 4.

The problem seems harmless in practice, but it can be confusing to see
a negative amount of remaining bytes to upload when inspecting libcurl
internals while debugging networking-related issues, for example.

So reset also this option to its default value (which is -1, not 0).

Signed-off-by: Jiri Hruska <jirka@xxxxxx>
---
 http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/http.c b/http.c
index 8f71bf00d8..14f2fbb82e 100644
--- a/http.c
+++ b/http.c
@@ -1454,6 +1454,7 @@ struct active_request_slot *get_active_slot(void)
 	curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL);
 	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
 	curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
+	curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)-1);
 	curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
 	curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
 	curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
-- 
2.42.1.5.g2f21867bd5




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux