MOHAMED
MOHAMED

Reputation: 43518

Using digest authentication with curl

I developed a basic authentication with libcurl in this way:

curl_easy_setopt(curl, CURLOPT_URL, "http://192.168.1.133:8080/myrep");
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "passwd");

I want to develop also the digest authentication with libcurl.

How to do it.

Did Libcurl support this behaviour

1) --> client send to the server a http request without authentication fields

2) <-- server respond with 401 need digest authentication and providing the authrealm

3) --> client send the same http message with digest authentication using the received authrealm

4) <-- In case of success. The server send authentication success and the client detect it via libcurl

5) <-- In case of failure. The server resend the 401 message and The client detect it via libcurl

Upvotes: 1

Views: 2148

Answers (1)

Daniel Stenberg
Daniel Stenberg

Reputation: 58014

yes, libcurl supports it. See CURLOPT_HTTPAUTH and then especially the CURLAUTH_DIGEST bit.

Upvotes: 2

Related Questions