2

While searching for a guide I found this example on Wikipedia

GET /dir/index.html HTTP/1.0
Host: localhost
Authorization: Digest username="Mufasa", realm="testrealm@host.com", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="/dir/index.html",
qop=auth,
nc=00000001,
cnonce="0a4f113b",
response="6629fae49393a05397450978507c4ef1",
opaque="5ccc069c403ebaf9f0171e9517f40e41"

(it would be great if there is a tool/site that converts requests from this form raw requests to curl command)

this the realm and nonce when I try to send a normal get request to the site.

 WWW-Authenticate: Digest realm="device1",nonce="3c5d8f92f03d9f1afd5dd55a7b172ee8", qop="auth", algorithm="MD5"

the response but from a network capture screen shot

After searching online again for a little bit I got that the command should be like this 

curl "url" --digest -u {username}:{pass} -vv -d @4.xml -H "Content-Type: text/xml;charset=utf-8" 

but I didn't get where to put the nonce or the realm or the qop or algorithm="MD5"

while the .xml file contain the post data (in my case it's a soap action)

5

You don't have to specify all those values anywhere. The only thing you do have to is username/password pair. CURL takes care of computing the client response for you. This is exactly what "supporting of digest authentication" means for any client.

answer by user Alexey R. from stack over flow

in addition by a user on another site the command should look like this

curl -v  'https://jigsaw.w3.org/HTTP/Digest/' --digest -u guest:guest --form data=blahblah
0

When using Digest authentication, you need to send an HTTP "Authorization" header, and this header is where the nonce etc should go.

However, Digest uses a challenge/response mechanism that requires the Authorization header to be sent in a second HTTP request, rather than in the original HTTP request.

The second HTTP request can only be sent once the original HTTP request has received a 401 response.

You should be able to get the idea from this closed GitHub issue where it's explained further about the way curl works with this.

3
  • nope this issue have nothing to do with my problem but i figured it out anyway.
    – mina nageh
    Aug 3 '20 at 15:50
  • hey @minanageh that's cool, why don't you post an answer with what the solution was in your case. It will help others with that problem in the future.
    – Reg Edit
    Aug 3 '20 at 19:28
  • ok...................done
    – mina nageh
    Aug 4 '20 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.