X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcurl_xml.c;h=c9f06518ba1db2499031bc9b66ba262a73567b6d;hb=0febfbd11d87acd8a0f10bbcf5d4a58bb68b8dc0;hp=a743753eb75c8bf8b588e5fe94ab21e923489438;hpb=68108d7b5688f4db5257a90437e50428a88d594a;p=collectd.git diff --git a/src/curl_xml.c b/src/curl_xml.c index a743753e..c9f06518 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -842,9 +842,16 @@ static int cx_init_curl (cx_t *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); if (db->user != NULL) { +#ifdef HAVE_CURLOPT_USERNAME + curl_easy_setopt (db->curl, CURLOPT_USERNAME, db->user); + curl_easy_setopt (db->curl, CURLOPT_PASSWORD, + (db->pass == NULL) ? "" : db->pass); +#else size_t credentials_size; credentials_size = strlen (db->user) + 2; @@ -861,13 +868,10 @@ static int cx_init_curl (cx_t *db) /* {{{ */ ssnprintf (db->credentials, credentials_size, "%s:%s", db->user, (db->pass == NULL) ? "" : db->pass); curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials); - +#endif + if (db->digest) - { curl_easy_setopt (db->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - curl_easy_setopt (db->curl, CURLOPT_USERNAME, db->user); - curl_easy_setopt (db->curl, CURLOPT_PASSWORD, db->pass); - } } curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, db->verify_peer ? 1L : 0L);