From 7d3a909598c1fc9def2069aeeccda58e305c738a Mon Sep 17 00:00:00 2001 From: poesty Date: Sun, 7 May 2023 13:42:47 +0800 Subject: Fixed webfinger and curl issues --- xs_curl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xs_curl.h') diff --git a/xs_curl.h b/xs_curl.h index ca90f92..d19d6e5 100644 --- a/xs_curl.h +++ b/xs_curl.h @@ -127,14 +127,15 @@ xs_dict *xs_http_request(const char *method, const char *url, curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _data_callback); if (strcmp(method, "POST") == 0 || strcmp(method, "PUT") == 0) { - curl_easy_setopt(curl, method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD, 1L); + CURLoption curl_method = method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD; + curl_easy_setopt(curl, curl_method, 1L); if (body != NULL) { if (b_size <= 0) b_size = xs_size(body); /* add the content-length header */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE, b_size); + curl_easy_setopt(curl, curl_method == CURLOPT_POST ? CURLOPT_POSTFIELDSIZE : CURLOPT_INFILESIZE, b_size); pd.data = (char *)body; pd.size = b_size; -- cgit v1.2.3