Commit bab51838 authored by Dan Fandrich's avatar Dan Fandrich
Browse files

Created Curl_raw_nequal() which does a C-locale string case comparison.

Changed checkprefix() to use it and those instances of strnequal() that
compare host names or other protocol strings that are defined to be
independent of case in the C locale.  This should fix a few more
Turkish locale problems.
parent 0abaf224
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static bool tailmatch(const char *little, const char *bigone)
  if(littlelen > biglen)
    return FALSE;

  return (bool)strequal(little, bigone+biglen-littlelen);
  return (bool)Curl_raw_equal(little, bigone+biglen-littlelen);
}

/*
+6 −6
Original line number Diff line number Diff line
@@ -163,9 +163,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
    /* AUTH is missing */
  }

  if(strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
      strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
      strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
  if(Curl_raw_nequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
      Curl_raw_nequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
      Curl_raw_nequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {

    word = strchr(path, ':');
    if(word) {
@@ -222,9 +222,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
    if(result)
      return result;
  }
  else if(strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
           strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
           strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
  else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
           Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
           Curl_raw_nequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {

    word = strchr(path, ':');
    if(word) {
+1 −1
Original line number Diff line number Diff line
@@ -4019,7 +4019,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)

    dlen -= ftpc->file?strlen(ftpc->file):0;
    if((dlen == (int)strlen(ftpc->prevpath)) &&
       curl_strnequal(path, ftpc->prevpath, dlen)) {
       strnequal(path, ftpc->prevpath, dlen)) {
      infof(data, "Request has same path as previous transfer\n");
      ftpc->cwddone = TRUE;
    }
+5 −6
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static char *checkheaders(struct SessionHandle *data, const char *thisheader)
  size_t thislen = strlen(thisheader);

  for(head = data->set.headers; head; head=head->next) {
    if(strnequal(head->data, thisheader, thislen))
    if(Curl_raw_nequal(head->data, thisheader, thislen))
      return head->data;
  }
  return NULL;
@@ -1246,7 +1246,7 @@ Curl_compareheader(const char *headerline, /* line to check */
  const char *start;
  const char *end;

  if(!strnequal(headerline, header, hlen))
  if(!Curl_raw_nequal(headerline, header, hlen))
    return FALSE; /* doesn't start with header */

  /* pass the header */
@@ -1272,7 +1272,7 @@ Curl_compareheader(const char *headerline, /* line to check */

  /* find the content string in the rest of the line */
  for(;len>=clen;len--, start++) {
    if(strnequal(start, content, clen))
    if(Curl_raw_nequal(start, content, clen))
      return TRUE; /* match! */
  }

@@ -2026,12 +2026,11 @@ static CURLcode add_custom_headers(struct connectdata *conn,
        if(conn->allocptr.host &&
           /* a Host: header was sent already, don't pass on any custom Host:
              header as that will produce *two* in the same request! */
           curl_strnequal("Host:", headers->data, 5))
           checkprefix("Host:", headers->data))
          ;
        else if(conn->data->set.httpreq == HTTPREQ_POST_FORM &&
                /* this header (extended by formdata.c) is sent later */
                curl_strnequal("Content-Type:", headers->data,
                               strlen("Content-Type:")))
                checkprefix("Content-Type:", headers->data))
          ;
        else {
          CURLcode result = add_bufferf(req_buffer, "%s\r\n", headers->data);
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ name_to_level(const char *name)
{
  int i;
  for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
    if(curl_strnequal(level_names[i].name, name, strlen(name)))
    if(checkprefix(name, level_names[i].name))
      return level_names[i].level;
  return (enum protection_level)-1;
}
Loading