X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_json.c;h=35461d34cdd04eca21f365274dc372f8e592f25f;hb=3559c66d34c46ddbe6580b7950eaba7c48393cc0;hp=36cc468b923c1272586bd4df491a511629a97a71;hpb=19c5725693a7271ab7e4d73026da2381b2044ab3;p=collectd.git diff --git a/src/curl_json.c b/src/curl_json.c index 36cc468b..35461d34 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -71,6 +71,7 @@ struct cj_s /* {{{ */ char *user; char *pass; char *credentials; + _Bool digest; _Bool verify_peer; _Bool verify_host; char *cacert; @@ -609,6 +610,13 @@ 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); + + 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); @@ -675,6 +683,8 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ status = cf_util_get_string (child, &db->user); else if (db->url && strcasecmp ("Password", child->key) == 0) status = cf_util_get_string (child, &db->pass); + else if (strcasecmp ("Digest", child->key) == 0) + status = cf_util_get_boolean (child, &db->digest); else if (db->url && strcasecmp ("VerifyPeer", child->key) == 0) status = cf_util_get_boolean (child, &db->verify_peer); else if (db->url && strcasecmp ("VerifyHost", child->key) == 0)