After redirect received, Collectd send subsequent requests to new location.
That is wrong - Collectd should use configured URL for all poll cycles, regardless of the responses received previously.
Problem was caused by libcurl issue 1631. To avoid that we set request url in each poll cycle.
Closes: #2328
#endif
}
- curl_easy_setopt(st->curl, CURLOPT_URL, st->url);
curl_easy_setopt(st->curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(st->curl, CURLOPT_MAXREDIRS, 50L);
assert(st->curl != NULL);
st->apache_buffer_fill = 0;
+
+ curl_easy_setopt(st->curl, CURLOPT_URL, st->url);
+
if (curl_easy_perform(st->curl) != CURLE_OK) {
ERROR("apache: curl_easy_perform failed: %s", st->apache_curl_error);
return (-1);
#endif
}
- curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
}
ascent_buffer_fill = 0;
+
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+
if (curl_easy_perform(curl) != CURLE_OK) {
ERROR("ascent plugin: curl_easy_perform failed: %s", ascent_curl_error);
return (-1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, bind_curl_callback);
curl_easy_setopt(curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, bind_curl_error);
- curl_easy_setopt(curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
#ifdef HAVE_CURLOPT_TIMEOUT_MS
}
bind_buffer_fill = 0;
+
+ curl_easy_setopt(curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
+
if (curl_easy_perform(curl) != CURLE_OK) {
ERROR("bind plugin: curl_easy_perform failed: %s", bind_curl_error);
return (-1);
curl_easy_setopt(wp->curl, CURLOPT_WRITEDATA, wp);
curl_easy_setopt(wp->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);
curl_easy_setopt(wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf);
- curl_easy_setopt(wp->curl, CURLOPT_URL, wp->url);
curl_easy_setopt(wp->curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(wp->curl, CURLOPT_MAXREDIRS, 50L);
start = cdtime();
wp->buffer_fill = 0;
+
+ curl_easy_setopt(wp->curl, CURLOPT_URL, wp->url);
+
status = curl_easy_perform(wp->curl);
if (status != CURLE_OK) {
ERROR("curl plugin: curl_easy_perform failed with status %i: %s", status,
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);
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)
long rc;
char *ptr;
char *url;
- url = db->url;
db->buffer_fill = 0;
+
+ curl_easy_setopt(db->curl, CURLOPT_URL, db->url);
+
status = curl_easy_perform(curl);
if (status != CURLE_OK) {
ERROR("curl_xml 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)
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);
#endif
}
- if (url != NULL) {
- curl_easy_setopt(curl, CURLOPT_URL, url);
- }
-
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
return (-1);
nginx_buffer_len = 0;
+
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+
if (curl_easy_perform(curl) != CURLE_OK) {
WARNING("nginx plugin: curl_easy_perform failed: %s", nginx_curl_error);
return (-1);
{
int status = 0;
+ curl_easy_setopt(cb->curl, CURLOPT_URL, cb->location);
curl_easy_setopt(cb->curl, CURLOPT_POSTFIELDS, data);
status = curl_easy_perform(cb->curl);
curl_easy_setopt(cb->curl, CURLOPT_HTTPHEADER, cb->headers);
curl_easy_setopt(cb->curl, CURLOPT_ERRORBUFFER, cb->curl_errbuf);
- curl_easy_setopt(cb->curl, CURLOPT_URL, cb->location);
curl_easy_setopt(cb->curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(cb->curl, CURLOPT_MAXREDIRS, 50L);