diff options
author | grunfink <grunfink@noreply.codeberg.org> | 2023-05-07 07:34:35 +0000 |
---|---|---|
committer | grunfink <grunfink@noreply.codeberg.org> | 2023-05-07 07:34:35 +0000 |
commit | 14950d6954ea689c1225df8963372d9b5a2ba4ec (patch) | |
tree | c2484af8006961d95dcf39cf16c3749100a713c9 /xs_curl.h | |
parent | 6a1cc55676eaf18ecadb42b86474aaef73cf9805 (diff) | |
parent | e65760a349112abce39404ca50f6bc2f1301bed9 (diff) |
Merge pull request 'Fixed webfinger and curl issues' (#31) from poesty/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/31
Diffstat (limited to 'xs_curl.h')
-rw-r--r-- | xs_curl.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |