From a579d6706436615845f57692921e0891fb6e3719 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 15 Oct 2008 21:43:48 +0000 Subject: - Pascal Terjan filed bug #2154627 (http://curl.haxx.se/bug/view.cgi?id=2154627) which pointed out that libcurl uses strcasecmp() in multiple places where it causes failures when the Turkish locale is used. This is because 'i' and 'I' isn't the same letter so strcasecmp() on those letters are different in Turkish than in English (or just about all other languages). I thus introduced a totally new internal function in libcurl (called Curl_ascii_equal) for doing case insentive comparisons for english-(ascii?) style strings that thus will make "file" and "FILE" match even if the Turkish locale is selected. --- lib/http_digest.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/http_digest.c') diff --git a/lib/http_digest.c b/lib/http_digest.c index 0d92652a0..2e774f3d4 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -110,28 +110,28 @@ CURLdigest Curl_input_digest(struct connectdata *conn, */ content[0]=0; } - if(strequal(value, "nonce")) { + if(Curl_ascii_equal(value, "nonce")) { d->nonce = strdup(content); if(!d->nonce) return CURLDIGEST_NOMEM; } - else if(strequal(value, "stale")) { - if(strequal(content, "true")) { + else if(Curl_ascii_equal(value, "stale")) { + if(Curl_ascii_equal(content, "true")) { d->stale = TRUE; d->nc = 1; /* we make a new nonce now */ } } - else if(strequal(value, "realm")) { + else if(Curl_ascii_equal(value, "realm")) { d->realm = strdup(content); if(!d->realm) return CURLDIGEST_NOMEM; } - else if(strequal(value, "opaque")) { + else if(Curl_ascii_equal(value, "opaque")) { d->opaque = strdup(content); if(!d->opaque) return CURLDIGEST_NOMEM; } - else if(strequal(value, "qop")) { + else if(Curl_ascii_equal(value, "qop")) { char *tok_buf; /* tokenize the list and choose auth if possible, use a temporary clone of the buffer since strtok_r() ruins it */ @@ -140,10 +140,10 @@ CURLdigest Curl_input_digest(struct connectdata *conn, return CURLDIGEST_NOMEM; token = strtok_r(tmp, ",", &tok_buf); while(token != NULL) { - if(strequal(token, "auth")) { + if(Curl_ascii_equal(token, "auth")) { foundAuth = TRUE; } - else if(strequal(token, "auth-int")) { + else if(Curl_ascii_equal(token, "auth-int")) { foundAuthInt = TRUE; } token = strtok_r(NULL, ",", &tok_buf); @@ -161,13 +161,13 @@ CURLdigest Curl_input_digest(struct connectdata *conn, return CURLDIGEST_NOMEM; } } - else if(strequal(value, "algorithm")) { + else if(Curl_ascii_equal(value, "algorithm")) { d->algorithm = strdup(content); if(!d->algorithm) return CURLDIGEST_NOMEM; - if(strequal(content, "MD5-sess")) + if(Curl_ascii_equal(content, "MD5-sess")) d->algo = CURLDIGESTALGO_MD5SESS; - else if(strequal(content, "MD5")) + else if(Curl_ascii_equal(content, "MD5")) d->algo = CURLDIGESTALGO_MD5; else return CURLDIGEST_BADALGO; @@ -362,7 +362,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, return CURLE_OUT_OF_MEMORY; } - if(d->qop && strequal(d->qop, "auth-int")) { + if(d->qop && Curl_ascii_equal(d->qop, "auth-int")) { /* We don't support auth-int at the moment. I can't see a easy way to get entity-body here */ /* TODO: Append H(entity-body)*/ @@ -423,7 +423,7 @@ CURLcode Curl_output_digest(struct connectdata *conn, d->qop, request_digest); - if(strequal(d->qop, "auth")) + if(Curl_ascii_equal(d->qop, "auth")) d->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0 padded which tells to the server how many times you are using the same nonce in the qop=auth mode. */ -- cgit v1.2.3