cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Caching the digest response and using it in subsequent request ...

From: Sanjeeth K.G <kg.sanjeeth_at_gmail.com>
Date: Tue, 18 May 2010 16:09:56 +0530

> Sorry Daniel,
>>
> My idea was not to give you hard time ...
this is the snippet from wikipage .... caching is described in the paragraph
below.
would caching be possible with libcurl, if yes how can this be achieved?

after first sucessfull request cycle i.e. is initial request from client 401
challenge from server, sucessfull response with authorization header from
client for e.g.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Client request (no authentication):
GET /dir/index.html HTTP/1.0
Host: localhost
(followed by a new line, in the form of a carriage return followed by a line
feed).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Server response:
HTTP/1.0 401 Unauthorized
Server: HTTPd/0.9
Date: Sun, 10 Apr 2005 20:26:47 GMT
WWW-Authenticate: Digest realm="testrealm_at_host.com",
                         qop="auth,auth-int",
                         nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
                         opaque="5ccc069c403ebaf9f0171e9517f40e41"
Content-Type: text/html
Content-Length: 311
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
  <HEAD>
    <TITLE>Error</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
  </HEAD>
  <BODY><H1>401 Unauthorized.</H1></BODY>
</HTML>

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Client request (user name "Mufasa", password "Circle Of Life"):
GET /dir/index.html HTTP/1.0
Host: localhost
Authorization: Digest username="Mufasa",
                      realm="testrealm_at_host.com",
                      nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",
                      uri="/dir/index.html",
                      qop=auth,
                      nc=00000001,
                      cnonce="0a4f113b",
                      response="6629fae49393a05397450978507c4ef1",
                      opaque="5ccc069c403ebaf9f0171e9517f40e41"
(followed by a blank line, as before).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Server response:
HTTP/1.0 200 OK
Server: HTTPd/0.9
Date: Sun, 10 Apr 2005 20:27:03 GMT
Content-Type: text/html
Content-Length: 7984
(followed by a blank line and HTML text of the restricted page).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

At this point the client may make another request, reusing the server nonce
value (the server only issues a new nonce for each "401" response) but
providing a new client nonce (cnonce). For subsequent requests, the
hexadecimal request counter (nc) must be greater than the last value it used
– otherwise an attacker could simply
"replay<http://en.wikipedia.org/wiki/Replay_attack>"
an old request with the same credentials. It is up to the server to ensure
that the counter increases for each of the nonce values that it has issued,
rejecting any bad requests appropriately. Obviously changing the method, URI
and/or counter value will result in a different response value.

Thanks for you patience :)
Sanjeeth

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-18