From bbecd892192d3bbc1fbbd7f5f24ab7d9cdef4a3e Mon Sep 17 00:00:00 2001 From: Prajwal T R Date: Sun, 10 Dec 2023 04:48:04 -0700 Subject: [PATCH] fix: libcurl upgrade breaking cloud backups - set only required http methods --- device-src/s3.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/device-src/s3.c b/device-src/s3.c index b9028bbb9f..c5e6b9e606 100644 --- a/device-src/s3.c +++ b/device-src/s3.c @@ -2653,19 +2653,29 @@ perform_request(S3Handle *hdl, goto curl_error; } #endif - - if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HTTPGET, curlopt_httpget))) - goto curl_error; - if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_UPLOAD, curlopt_upload))) - goto curl_error; - if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_POST, curlopt_post))) - goto curl_error; - if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_NOBODY, curlopt_nobody))) - goto curl_error; - if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_CUSTOMREQUEST, - curlopt_customrequest))) - goto curl_error; - + // set only required http method + // libcurl seems to behave strangely in 7.29 > i.e. 7.81 + if(curlopt_httpget) { + if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HTTPGET, curlopt_httpget))) + goto curl_error; + } + if(curlopt_upload) { + if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_UPLOAD, curlopt_upload))) + goto curl_error; + } + if(curlopt_post) { + if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_POST, curlopt_post))) + goto curl_error; + } + if(curlopt_nobody) { + if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_NOBODY, curlopt_nobody))) + goto curl_error; + } + if(curlopt_customrequest) { + if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_CUSTOMREQUEST, + curlopt_customrequest))) + goto curl_error; + } if (curlopt_upload || curlopt_post) { if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READFUNCTION, read_func)))