diff options
| author | 2023-05-07 13:42:47 +0800 | |
|---|---|---|
| committer | 2023-05-07 13:42:47 +0800 | |
| commit | 7d3a909598c1fc9def2069aeeccda58e305c738a (patch) | |
| tree | 0c23bdce8015e3a155c2a267409e8919d6ebb7bf /xs_curl.h | |
| parent | Version 2.29 RELEASED. (diff) | |
| download | penes-snac2-7d3a909598c1fc9def2069aeeccda58e305c738a.tar.gz penes-snac2-7d3a909598c1fc9def2069aeeccda58e305c738a.tar.xz penes-snac2-7d3a909598c1fc9def2069aeeccda58e305c738a.zip | |
Fixed webfinger and curl issues
Diffstat (limited to '')
| -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, | |||
| 127 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _data_callback); | 127 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _data_callback); |
| 128 | 128 | ||
| 129 | if (strcmp(method, "POST") == 0 || strcmp(method, "PUT") == 0) { | 129 | if (strcmp(method, "POST") == 0 || strcmp(method, "PUT") == 0) { |
| 130 | curl_easy_setopt(curl, method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD, 1L); | 130 | CURLoption curl_method = method[1] == 'O' ? CURLOPT_POST : CURLOPT_UPLOAD; |
| 131 | curl_easy_setopt(curl, curl_method, 1L); | ||
| 131 | 132 | ||
| 132 | if (body != NULL) { | 133 | if (body != NULL) { |
| 133 | if (b_size <= 0) | 134 | if (b_size <= 0) |
| 134 | b_size = xs_size(body); | 135 | b_size = xs_size(body); |
| 135 | 136 | ||
| 136 | /* add the content-length header */ | 137 | /* add the content-length header */ |
| 137 | curl_easy_setopt(curl, CURLOPT_INFILESIZE, b_size); | 138 | curl_easy_setopt(curl, curl_method == CURLOPT_POST ? CURLOPT_POSTFIELDSIZE : CURLOPT_INFILESIZE, b_size); |
| 138 | 139 | ||
| 139 | pd.data = (char *)body; | 140 | pd.data = (char *)body; |
| 140 | pd.size = b_size; | 141 | pd.size = b_size; |