summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a2983ff)
raw | patch | inline | side by side (parent: a2983ff)
author | Rainer Müller <raimue@codingfarm.de> | |
Sun, 10 Nov 2013 02:39:22 +0000 (03:39 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 13 Nov 2013 18:55:57 +0000 (19:55 +0100) |
The variable url is used unintialized here. The code used to be the same
in both plugins, but diverged in 19808b44. The solution applied there
does not work correctly as the effective URL can only be queried after
performing the request. Instead, just use the original request URL.
Signed-off-by: Florian Forster <octo@collectd.org>
in both plugins, but diverged in 19808b44. The solution applied there
does not work correctly as the effective URL can only be queried after
performing the request. Instead, just use the original request URL.
Signed-off-by: Florian Forster <octo@collectd.org>
src/curl_json.c | patch | blob | history | |
src/curl_xml.c | patch | blob | history |
diff --git a/src/curl_json.c b/src/curl_json.c
index 511863e39f12e98b3914f83ebc0ba446f5db4f20..6c7cf8d87676399833d25cf9c836c1fdd999f4ab 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
int status;
long rc;
char *url;
- url = NULL;
- curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
+ 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 != NULL) ? url : "<null>");
+ status, db->curl_errbuf, url);
return (-1);
}
+ curl_easy_getinfo(db->curl, CURLINFO_EFFECTIVE_URL, &url);
curl_easy_getinfo(db->curl, CURLINFO_RESPONSE_CODE, &rc);
/* The response code is zero if a non-HTTP transport was used. */
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 5adaf067a157e44220655adb79855c6fee0d3b26..5d14a1d9079810a68891697f1d10bbbffde68afe 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
long rc;
char *ptr;
char *url;
+ url = db->url;
db->buffer_fill = 0;
status = curl_easy_perform (curl);