|
|
|
@ -186,7 +186,8 @@ static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb,
@@ -186,7 +186,8 @@ static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb,
|
|
|
|
|
return len; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data) |
|
|
|
|
static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data, |
|
|
|
|
struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
struct header_info *hi = user_data; |
|
|
|
|
size_t remlen, slen, ptrlen = size * nmemb; |
|
|
|
@ -225,6 +226,11 @@ static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data)
@@ -225,6 +226,11 @@ static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data)
|
|
|
|
|
if (opt_protocol) |
|
|
|
|
applog(LOG_DEBUG, "HTTP hdr(%s): %s", key, val); |
|
|
|
|
|
|
|
|
|
if (!strcasecmp("X-Roll-Ntime", key)) { |
|
|
|
|
applog(LOG_INFO, "X-Roll-Ntime found"); |
|
|
|
|
pool->has_rolltime = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!strcasecmp("X-Long-Polling", key)) { |
|
|
|
|
hi->lp_path = val; /* steal memory reference */ |
|
|
|
|
val = NULL; |
|
|
|
@ -240,7 +246,8 @@ static bool comms_error = false;
@@ -240,7 +246,8 @@ static bool comms_error = false;
|
|
|
|
|
|
|
|
|
|
json_t *json_rpc_call(CURL *curl, const char *url, |
|
|
|
|
const char *userpass, const char *rpc_req, |
|
|
|
|
bool longpoll_scan, bool longpoll) |
|
|
|
|
bool longpoll_scan, bool longpoll, |
|
|
|
|
bool getroll, struct pool *pool) |
|
|
|
|
{ |
|
|
|
|
json_t *val, *err_val, *res_val; |
|
|
|
|
int rc; |
|
|
|
@ -271,7 +278,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
@@ -271,7 +278,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_data); |
|
|
|
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str); |
|
|
|
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); |
|
|
|
|
if (lp_scanning) { |
|
|
|
|
if (lp_scanning || getroll) { |
|
|
|
|
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, resp_hdr_cb); |
|
|
|
|
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hi); |
|
|
|
|
} |
|
|
|
|