summaryrefslogtreecommitdiff
path: root/xs_curl.h
diff options
context:
space:
mode:
authorpoesty <poesty7450@gmail.com>2023-05-07 13:42:47 +0800
committerpoesty <poesty7450@gmail.com>2023-05-07 13:42:47 +0800
commit7d3a909598c1fc9def2069aeeccda58e305c738a (patch)
tree0c23bdce8015e3a155c2a267409e8919d6ebb7bf /xs_curl.h
parentfbd30cf6d343651c53d5761b94fdaa04b867f416 (diff)
Fixed webfinger and curl issues
Diffstat (limited to 'xs_curl.h')
-rw-r--r--xs_curl.h5
1 files changed, 3 insertions, 2 deletions
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;