mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 04:24:19 +00:00
don't send Transfer-Encoding: chunked for newer libcurl
This commit is contained in:
parent
4b8831488b
commit
92838e0910
26
util.c
26
util.c
@ -145,24 +145,6 @@ static size_t all_data_cb(const void *ptr, size_t size, size_t nmemb,
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb,
|
||||
void *user_data)
|
||||
{
|
||||
struct upload_buffer *ub = (struct upload_buffer *)user_data;
|
||||
unsigned int len = size * nmemb;
|
||||
|
||||
if (len > ub->len)
|
||||
len = ub->len;
|
||||
|
||||
if (len > 0) {
|
||||
memcpy(ptr, ub->buf, len);
|
||||
ub->buf = (uint8_t*)ub->buf + len;
|
||||
ub->len -= len;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data)
|
||||
{
|
||||
struct header_info *hi = (struct header_info *)user_data;
|
||||
@ -339,8 +321,6 @@ json_t *json_rpc_call(CURL *curl, char *curl_err_str, const char *url,
|
||||
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);
|
||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb);
|
||||
@ -360,14 +340,12 @@ json_t *json_rpc_call(CURL *curl, char *curl_err_str, const char *url,
|
||||
if (longpoll)
|
||||
keep_curlalive(curl);
|
||||
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)
|
||||
applog(LOG_DEBUG, "JSON protocol request:\n%s", rpc_req);
|
||||
|
||||
upload_data.buf = rpc_req;
|
||||
upload_data.len = strlen(rpc_req);
|
||||
sprintf(len_hdr, "Content-Length: %lu",
|
||||
(unsigned long) upload_data.len);
|
||||
sprintf(user_agent_hdr, "User-Agent: %s", PACKAGE_STRING);
|
||||
|
||||
headers = curl_slist_append(headers,
|
||||
|
Loading…
x
Reference in New Issue
Block a user