From 30588be6dbb50fb103c14cfc13bec2f8fe90be0a Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 17 Sep 2022 16:35:12 -0400 Subject: [PATCH] don't send Transfer-Encoding: chunked for newer libcurl --- util.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/util.c b/util.c index 951ae68..b5cbb22 100644 --- a/util.c +++ b/util.c @@ -85,7 +85,6 @@ json_t *json_rpc_call(const char *url, const char *userpass, const char *rpc_req json_t *val; int rc; struct data_buffer all_data = { }; - struct upload_buffer upload_data; json_error_t err = { }; struct curl_slist *headers = NULL; char len_hdr[64]; @@ -102,22 +101,17 @@ json_t *json_rpc_call(const char *url, const char *userpass, const char *rpc_req curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb); - curl_easy_setopt(curl, CURLOPT_READDATA, &upload_data); if (userpass) { curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } curl_easy_setopt(curl, CURLOPT_POST, 1); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen (rpc_req)); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, rpc_req); if (opt_protocol) printf("JSON protocol request:\n%s\n", rpc_req); - upload_data.buf = rpc_req; - upload_data.len = strlen(rpc_req); - sprintf(len_hdr, "Content-Length: %lu", - (unsigned long) upload_data.len); - headers = curl_slist_append(headers, "Content-type: application/json"); headers = curl_slist_append(headers, len_hdr);