aboutsummaryrefslogtreecommitdiff
path: root/lib/http_digest.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-12-10 23:13:31 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-12-10 23:13:31 +0000
commit6e376532b00879ead13d5e07453ab8dd0d97571e (patch)
treeed84d9a37b1a344f4c3b5cdff4ea96bf7a55a7a9 /lib/http_digest.c
parent4ed64fd5ee1ac4a845bbfe8c0316051746120243 (diff)
- Internet Explorer had a broken HTTP digest authentication before v7 and
there are servers "out there" that relies on the client doing this broken Digest authentication. Apache even comes with an option to work with such broken clients. The difference is only for URLs that contain a query-part (a '?'-letter and text to the right of it). libcurl now supports this quirk, and you enable it by setting the CURLAUTH_DIGEST_IE bit in the bitmask you pass to the CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH options. They are thus individually controlled to server and proxy.
Diffstat (limited to 'lib/http_digest.c')
-rw-r--r--lib/http_digest.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/http_digest.c b/lib/http_digest.c
index be5ca5a8d..bab95e9de 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -356,7 +356,25 @@ CURLcode Curl_output_digest(struct connectdata *conn,
5.1.1 of RFC 2616)
*/
- md5this = (unsigned char *)aprintf("%s:%s", request, uripath);
+ /* So IE browsers < v7 cut off the URI part at the query part when they
+ evaluate the MD5 and some (IIS?) servers work with them so we may need to
+ do the Digest IE-style. Note that the different ways cause different MD5
+ sums to get sent.
+
+ Apache servers can be set to do the Digest IE-style automatically using
+ the BrowserMatch feature:
+ http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie
+
+ Further details on Digest implementation differences:
+ http://www.fngtps.com/2006/09/http-authentication
+ */
+ if(authp->iestyle && (tmp = strchr((char *)uripath, '?'))) {
+ md5this = (unsigned char *)aprintf("%s:%.*s", request,
+ (int)(tmp - (char *)uripath), uripath);
+ }
+ else
+ md5this = (unsigned char *)aprintf("%s:%s", request, uripath);
+
if(!md5this) {
free(ha1);
return CURLE_OUT_OF_MEMORY;