X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_http.c;h=8d3b85b366079e75232a5ff8dcfd9a586aa39c61;hb=f03005bd330f0c060025aef8b6fcac1bc55a3ca5;hp=9d8f30c2a6a2ed2324924d9c74500d8f09e950d8;hpb=c305b2fde172854c6ee61351bc676a9b70d85d27;p=collectd.git diff --git a/src/write_http.c b/src/write_http.c index 9d8f30c2..8d3b85b3 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -140,6 +140,11 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */ if (cb->user != NULL) { +#ifdef HAVE_CURLOPT_USERNAME + curl_easy_setopt (cb->curl, CURLOPT_USERNAME, cb->user); + curl_easy_setopt (cb->curl, CURLOPT_PASSWORD, + (cb->pass == NULL) ? "" : cb->pass); +#else size_t credentials_size; credentials_size = strlen (cb->user) + 2; @@ -156,6 +161,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */ ssnprintf (cb->credentials, credentials_size, "%s:%s", cb->user, (cb->pass == NULL) ? "" : cb->pass); curl_easy_setopt (cb->curl, CURLOPT_USERPWD, cb->credentials); +#endif curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); }