X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_xml.c;h=c0ab6fdbed7721374ccbff5e180dce6e897a7690;hb=a2e732f8fc1673f0f30ac93aefab32d757ea17c3;hp=a743753eb75c8bf8b588e5fe94ab21e923489438;hpb=bca0f0af973fcd4b34e3cf6072e193ac9dbc65fc;p=collectd.git diff --git a/src/curl_xml.c b/src/curl_xml.c index a743753e..c0ab6fdb 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -845,6 +845,11 @@ static int cx_init_curl (cx_t *db) /* {{{ */ 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 +866,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);