X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_json.c;h=8a084fed6fb9bb3bbb3d4c619579f9a83317b97d;hb=36ec9126a7847eddea46a54f7a6f932480a62628;hp=a84cba042b924d6e3b7667066889ead4ab41ca72;hpb=bca0f0af973fcd4b34e3cf6072e193ac9dbc65fc;p=collectd.git diff --git a/src/curl_json.c b/src/curl_json.c index a84cba04..8a084fed 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -595,6 +595,11 @@ static int cj_init_curl (cj_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; @@ -611,13 +616,10 @@ static int cj_init_curl (cj_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, (long) db->verify_peer);