Commit 811a693b authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

strcasecompare: all case insensitive string compares ignore locale now

We had some confusions on when each function was used. We should not act
differently on different locales anyway.
parent 502acba2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
  http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c    \
  strerror.c amigaos.c hostasyn.c hostip4.c hostip6.c hostsyn.c         \
  inet_ntop.c parsedate.c select.c tftp.c splay.c strdup.c socks.c      \
  ssh.c rawstr.c curl_addrinfo.c socks_gssapi.c socks_sspi.c            \
  ssh.c curl_addrinfo.c socks_gssapi.c socks_sspi.c            \
  curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c pop3.c smtp.c    \
  pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c        \
  openldap.c curl_gethostname.c gopher.c idn_win32.c                    \
@@ -64,7 +64,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
  http_negotiate.h inet_pton.h amigaos.h strtoofft.h strerror.h         \
  inet_ntop.h curlx.h curl_memory.h curl_setup.h transfer.h select.h    \
  easyif.h multiif.h parsedate.h tftp.h sockaddr.h splay.h strdup.h     \
  socks.h ssh.h curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h      \
  socks.h ssh.h curl_base64.h curl_addrinfo.h curl_sspi.h      \
  slist.h nonblock.h curl_memrchr.h imap.h pop3.h smtp.h pingpong.h     \
  rtsp.h curl_threads.h warnless.h curl_hmac.h curl_rtmp.h              \
  curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h           \
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include "progress.h"
#include "multiif.h"
#include "sendf.h"
#include "rawstr.h"
#include "conncache.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
+15 −15
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ Example set of cookies:
#include "slist.h"
#include "share.h"
#include "strtoofft.h"
#include "rawstr.h"
#include "strcase.h"
#include "curl_memrchr.h"
#include "inet_pton.h"

@@ -125,7 +125,7 @@ static bool tailmatch(const char *cooke_domain, const char *hostname)
  if(hostname_len < cookie_domain_len)
    return FALSE;

  if(!Curl_raw_equal(cooke_domain, hostname+hostname_len-cookie_domain_len))
  if(!strcasecompare(cooke_domain, hostname+hostname_len-cookie_domain_len))
    return FALSE;

  /* A lead char of cookie_domain is not '.'.
@@ -468,9 +468,9 @@ Curl_cookie_add(struct Curl_easy *data,
          /* this was a "<name>=" with no content, and we must allow
             'secure' and 'httponly' specified this weirdly */
          done = TRUE;
          if(Curl_raw_equal("secure", name))
          if(strcasecompare("secure", name))
            co->secure = TRUE;
          else if(Curl_raw_equal("httponly", name))
          else if(strcasecompare("httponly", name))
            co->httponly = TRUE;
          else if(sep)
            /* there was a '=' so we're not done parsing this field */
@@ -478,7 +478,7 @@ Curl_cookie_add(struct Curl_easy *data,
        }
        if(done)
          ;
        else if(Curl_raw_equal("path", name)) {
        else if(strcasecompare("path", name)) {
          strstore(&co->path, whatptr);
          if(!co->path) {
            badcookie = TRUE; /* out of memory bad */
@@ -490,7 +490,7 @@ Curl_cookie_add(struct Curl_easy *data,
            break;
          }
        }
        else if(Curl_raw_equal("domain", name)) {
        else if(strcasecompare("domain", name)) {
          bool is_ip;
          const char *dotp;

@@ -528,14 +528,14 @@ Curl_cookie_add(struct Curl_easy *data,
                  whatptr);
          }
        }
        else if(Curl_raw_equal("version", name)) {
        else if(strcasecompare("version", name)) {
          strstore(&co->version, whatptr);
          if(!co->version) {
            badcookie = TRUE;
            break;
          }
        }
        else if(Curl_raw_equal("max-age", name)) {
        else if(strcasecompare("max-age", name)) {
          /* Defined in RFC2109:

             Optional.  The Max-Age attribute defines the lifetime of the
@@ -551,7 +551,7 @@ Curl_cookie_add(struct Curl_easy *data,
            break;
          }
        }
        else if(Curl_raw_equal("expires", name)) {
        else if(strcasecompare("expires", name)) {
          strstore(&co->expirestr, whatptr);
          if(!co->expirestr) {
            badcookie = TRUE;
@@ -712,7 +712,7 @@ Curl_cookie_add(struct Curl_easy *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 = Curl_raw_equal(ptr, "TRUE")?TRUE:FALSE;
        co->tailmatch = strcasecompare(ptr, "TRUE")?TRUE:FALSE;
        break;
      case 2:
        /* It turns out, that sometimes the file format allows the path
@@ -741,7 +741,7 @@ Curl_cookie_add(struct Curl_easy *data,
        fields++; /* add a field and fall down to secure */
        /* FALLTHROUGH */
      case 3:
        co->secure = Curl_raw_equal(ptr, "TRUE")?TRUE:FALSE;
        co->secure = strcasecompare(ptr, "TRUE")?TRUE:FALSE;
        break;
      case 4:
        co->expires = curlx_strtoofft(ptr, NULL, 10);
@@ -812,11 +812,11 @@ Curl_cookie_add(struct Curl_easy *data,
  clist = c->cookies;
  replace_old = FALSE;
  while(clist) {
    if(Curl_raw_equal(clist->name, co->name)) {
    if(strcasecompare(clist->name, co->name)) {
      /* the names are identical */

      if(clist->domain && co->domain) {
        if(Curl_raw_equal(clist->domain, co->domain) &&
        if(strcasecompare(clist->domain, co->domain) &&
          (clist->tailmatch == co->tailmatch))
          /* The domains are identical */
          replace_old=TRUE;
@@ -828,7 +828,7 @@ Curl_cookie_add(struct Curl_easy *data,
        /* the domains were identical */

        if(clist->spath && co->spath) {
          if(Curl_raw_equal(clist->spath, co->spath)) {
          if(strcasecompare(clist->spath, co->spath)) {
            replace_old = TRUE;
          }
          else
@@ -1101,7 +1101,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
      /* now check if the domain is correct */
      if(!co->domain ||
         (co->tailmatch && !is_ip && tailmatch(co->domain, host)) ||
         ((!co->tailmatch || is_ip) && Curl_raw_equal(host, co->domain)) ) {
         ((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) {
        /* the right part of the host matches the domain stuff in the
           cookie data */

+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@

#include "urldata.h"
#include "non-ascii.h"
#include "rawstr.h"
#include "strcase.h"
#include "curl_ntlm_core.h"
#include "curl_md5.h"
#include "curl_hmac.h"
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
#include "curl_sasl.h"
#include "warnless.h"
#include "strtok.h"
#include "rawstr.h"
#include "sendf.h"
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
/* The last 3 #include files should be in this order */
Loading