curl_easy_setopt(db->curl, CURLOPT_WRITEDATA, db);
curl_easy_setopt(db->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);
curl_easy_setopt(db->curl, CURLOPT_ERRORBUFFER, db->curl_errbuf);
- curl_easy_setopt(db->curl, CURLOPT_URL, db->url);
curl_easy_setopt(db->curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(db->curl, CURLOPT_MAXREDIRS, 50L);
}
snprintf(db->credentials, credentials_size, "%s:%s", db->user,
- (db->pass == NULL) ? "" : db->pass);
+ (db->pass == NULL) ? "" : db->pass);
curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
#endif
int len = 0;
for (int i = 0; i < db->depth; i++)
len += snprintf(vl.type_instance + len, sizeof(vl.type_instance) - len,
- i ? "-%s" : "%s", db->state[i + 1].name);
+ i ? "-%s" : "%s", db->state[i + 1].name);
} else
sstrncpy(vl.type_instance, key->instance, sizeof(vl.type_instance));
int status;
long rc;
char *url;
- url = db->url;
+
+ curl_easy_setopt(db->curl, CURLOPT_URL, db->url);
status = curl_easy_perform(db->curl);
if (status != CURLE_OK) {
ERROR("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)",
- status, db->curl_errbuf, url);
+ status, db->curl_errbuf, db->url);
return -1;
}
if (db->stats != NULL)