diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-10-15 21:43:48 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-10-15 21:43:48 +0000 |
commit | a579d6706436615845f57692921e0891fb6e3719 (patch) | |
tree | 936f3c7c41195e63bfd13c2f2b0151e1db1db397 /lib/cookie.c | |
parent | be760bed7e544136eaa175f0fe58251da1ff6e41 (diff) |
- 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.
Diffstat (limited to 'lib/cookie.c')
-rw-r--r-- | lib/cookie.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/cookie.c b/lib/cookie.c index 982bed063..2886c18a2 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -243,14 +243,14 @@ Curl_cookie_add(struct SessionHandle *data, whatptr++; } - if(strequal("path", name)) { + if(Curl_ascii_equal("path", name)) { co->path=strdup(whatptr); if(!co->path) { badcookie = TRUE; /* out of memory bad */ break; } } - else if(strequal("domain", name)) { + else if(Curl_ascii_equal("domain", name)) { /* note that this name may or may not have a preceeding dot, but we don't care about that, we treat the names the same anyway */ @@ -315,14 +315,14 @@ Curl_cookie_add(struct SessionHandle *data, } } } - else if(strequal("version", name)) { + else if(Curl_ascii_equal("version", name)) { co->version=strdup(whatptr); if(!co->version) { badcookie = TRUE; break; } } - else if(strequal("max-age", name)) { + else if(Curl_ascii_equal("max-age", name)) { /* Defined in RFC2109: Optional. The Max-Age attribute defines the lifetime of the @@ -341,7 +341,7 @@ Curl_cookie_add(struct SessionHandle *data, atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) + (long)now; } - else if(strequal("expires", name)) { + else if(Curl_ascii_equal("expires", name)) { co->expirestr=strdup(whatptr); if(!co->expirestr) { badcookie = TRUE; @@ -371,10 +371,10 @@ Curl_cookie_add(struct SessionHandle *data, else { if(sscanf(ptr, "%" MAX_COOKIE_LINE_TXT "[^;\r\n]", what)) { - if(strequal("secure", what)) { + if(Curl_ascii_equal("secure", what)) { co->secure = TRUE; } - else if (strequal("httponly", what)) { + else if (Curl_ascii_equal("httponly", what)) { co->httponly = TRUE; } /* else, @@ -498,7 +498,7 @@ Curl_cookie_add(struct SessionHandle *data, As far as I can see, it is set to true when the cookie says .domain.com and to false when the domain is complete www.domain.com */ - co->tailmatch=(bool)strequal(ptr, "TRUE"); /* store information */ + co->tailmatch=(bool)Curl_ascii_equal(ptr, "TRUE"); /* store information */ break; case 2: /* It turns out, that sometimes the file format allows the path @@ -518,7 +518,7 @@ Curl_cookie_add(struct SessionHandle *data, fields++; /* add a field and fall down to secure */ /* FALLTHROUGH */ case 3: - co->secure = (bool)strequal(ptr, "TRUE"); + co->secure = (bool)Curl_ascii_equal(ptr, "TRUE"); break; case 4: co->expires = curlx_strtoofft(ptr, NULL, 10); @@ -571,11 +571,11 @@ Curl_cookie_add(struct SessionHandle *data, clist = c->cookies; replace_old = FALSE; while(clist) { - if(strequal(clist->name, co->name)) { + if(Curl_ascii_equal(clist->name, co->name)) { /* the names are identical */ if(clist->domain && co->domain) { - if(strequal(clist->domain, co->domain)) + if(Curl_ascii_equal(clist->domain, co->domain)) /* The domains are identical */ replace_old=TRUE; } @@ -586,7 +586,7 @@ Curl_cookie_add(struct SessionHandle *data, /* the domains were identical */ if(clist->path && co->path) { - if(strequal(clist->path, co->path)) { + if(Curl_ascii_equal(clist->path, co->path)) { replace_old = TRUE; } else @@ -778,7 +778,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, /* now check if the domain is correct */ if(!co->domain || (co->tailmatch && tailmatch(co->domain, host)) || - (!co->tailmatch && strequal(host, co->domain)) ) { + (!co->tailmatch && Curl_ascii_equal(host, co->domain)) ) { /* the right part of the host matches the domain stuff in the cookie data */ |