curl-library
Digest auth fails after 5 minuts of idling
Date: Thu, 18 Mar 2004 04:14:08 -0800 (PST)
Hi Daniel & all,
I am using curl_easy interface (v 7.10.8).
Config:
- Apache 2 on HR 7.2 with Digest auth enforced.
- no firewalls
- Client platform: Windows XP
- libcurl buiit with VisualStudio .Net 2003
- no SSL
I am seeing a problem where libcurl fails to authenticate against the server using Digest if the connection gets idles over 5 minuts or so. I can reproduce this every time using this simple code.
Is this a known bug? Am I missing some curl option to use? Any advice would be appreciated!!
============= Simple code to reproduce ==========
int main(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode result;
int sleepTime;
long returnCode;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_URL, "http://server01:81/digest/proxy.htm");
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:pass");
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
result = curl_easy_perform(curl);
printf("\n\n*** result = %d ***\n\n", result);
/* wait 5 minutes */
sleepTime = 1000 * 60 * 5;
_sleep(sleepTime);
result = curl_easy_perform(curl);
returnCode = 0;
curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &returnCode);
printf("\n\n*** result = %d, httpcode = %d ***\n\n", result, returnCode);
printf("press return to quit.");
scanf("a");
return 0;
}
==================== Output ============================
* About to connect() to server01:81
* Connected to server01 (192.168.65.36) port 81
> GET /digest/proxy.htm HTTP/1.1
Host: server01:81
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
< HTTP/1.1 401 Authorization Required
< Date: Thu, 18 Mar 2004 10:43:04 GMT
< Server: Apache/2.0.48 (Unix) DAV/2
< WWW-Authenticate: Digest realm="DAV_Area_Digest", nonce="TSD7fuXVAwA=c027035c6
3b7fae3fd850397a80377fbfd9dd8fe", algorithm=MD5, qop="auth"
< Content-Length: 482
< Content-Type: text/html; charset=iso-8859-1
* Ignoring the response-body
* Connection #0 left intact
* Issue another request to this URL: 'http://server01:81/digest/proxy.htm'
* Re-using existing connection! (#0)
* Connected to (192.168.65.36) port 81
* Server auth using Digest with user 'user'
> GET /digest/proxy.htm HTTP/1.1
Authorization: Digest username="user", realm="DAV_Area_Digest", nonce="TSD7fuXV
AwA=c027035c63b7fae3fd850397a80377fbfd9dd8fe", uri="/digest/proxy.htm", resp
onse="e195de7ce9389465c70ce157f06c904f"
Host: server01:81
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
< HTTP/1.1 200 OK
< Date: Thu, 18 Mar 2004 10:43:04 GMT
< Server: Apache/2.0.48 (Unix) DAV/2
< Authentication-Info: rspauth="ea8b4cf73667e7dec003e7006a43509a"
< Last-Modified: Wed, 17 Mar 2004 09:47:22 GMT
< ETag: "27e7c-167-99e57e80"
< Accept-Ranges: bytes
< Content-Length: 359
< Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>proxy</title>
</head>
<body>
fffvia proxy<img src="images/Winter.jpg" width="80" height="60" hspace="0" vspac
e="0" align="default">
</body>
</html>
* Connection #0 left intact
*** result = 0 ***
* Connection 0 seems to be dead!
* Closing connection #0
* About to connect() to server01:81
* Connected to server01 (192.168.65.36) port 81
* Server auth using Digest with user 'user'
> GET /digest/proxy.htm HTTP/1.1
Authorization: Digest username="user", realm="DAV_Area_Digest", nonce="TSD7fuXV
AwA=c027035c63b7fae3fd850397a80377fbfd9dd8fe", uri="/digest/proxy.htm", resp
onse="e195de7ce9389465c70ce157f06c904f"
Host: server01:81
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
< HTTP/1.1 401 Authorization Required
< Date: Thu, 18 Mar 2004 10:48:04 GMT
< Server: Apache/2.0.48 (Unix) DAV/2
* Authentication problem. Ignoring this.
< WWW-Authenticate: Digest realm="DAV_Area_Digest", nonce="PqPdkOXVAwA=0c83a1ae6
a1aa0fbf880c4a481d7af95f6998741", algorithm=MD5, stale=true, qop="auth"
< Content-Length: 482
< Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<hr />
<address>Apache/2.0.48 (Unix) DAV/2 Server at server01 Port 81</address>
</body></html>
* Connection #0 left intact
*** result = 0, httpcode = 401 ***
press any key to quit.
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
Received on 2004-03-18