I amended three tests to fail when run with turkish locale.
I fixed these issues (using c_strcasecmp/c_strncasecmp) and also replaced
strcasecmp/strncasecmp by c_strcasecmp/c_strncasecmp at places where we
definitely want a ASCII comparison instead of a locale dependent one.

There are still some places left where we use strcasecmp/strncasecmp, e.g.
domain/host and filename comparisons.

Please have a look...

Tim
From 84640d2ddbf3d18f42377b1b405629c275e8e94f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?= <[email protected]>
Date: Tue, 18 Nov 2014 16:56:09 +0100
Subject: [PATCH] Fix possible issues with Wget running in a turkish locale

---
 src/ChangeLog                          | 10 ++++++++++
 src/cookies.c                          |  3 ++-
 src/ftp-basic.c                        | 19 ++++++++++---------
 src/ftp-ls.c                           |  9 +++++----
 src/ftp.c                              |  3 ++-
 src/html-url.c                         | 21 +++++++++++----------
 src/http.c                             | 20 ++++++++++----------
 src/init.c                             | 11 ++++++-----
 src/iri.c                              |  9 +++++----
 src/main.c                             |  3 ++-
 src/progress.c                         |  9 +++++----
 src/res.c                              |  1 +
 src/url.c                              |  3 ++-
 src/utils.c                            |  7 ++++---
 src/wget.h                             |  2 +-
 testenv/ChangeLog                      |  6 ++++++
 testenv/Test-Content-disposition-2.py  |  3 ++-
 testenv/Test-cookie-domain-mismatch.py |  3 ++-
 testenv/Test-cookie-expires.py         |  3 ++-
 19 files changed, 88 insertions(+), 57 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 34d6258..135a81d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-18  Tim Ruehsen <[email protected]>
+
+	* cookies.c, ftp-basic.c, ftp-ls.c, ftp.c, html-url.c,
+	  http.c, init.c, iri.c, main.c, progress.c, res.c, url.c,
+	  utils.c, wget.h: Replaced strcasecmp and strncasecmp by
+	  c_strcasecmp and c_strncasecmp where only ASCII string
+	  comparison is wanted (instead of locale dependent).
+
+	  Fixes possible issues with Wget running in a turkish locale.
+
 2014-11-17  Tim Ruehsen  <[email protected]>

 	* gnutls.c (ssl_init): Report load failure of cert files from
diff --git a/src/cookies.c b/src/cookies.c
index bf872a8..0539729 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -58,7 +58,8 @@ as that of the covered work.  */
 #include "hash.h"
 #include "cookies.h"
 #include "http.h"               /* for http_atotm */
-
+#include "c-strcase.h"
+
 /* Declarations of `struct cookie' and the most basic functions. */

 /* Cookie jar serves as cookie storage and a means of retrieving
diff --git a/src/ftp-basic.c b/src/ftp-basic.c
index b6e67e2..171b4bc 100644
--- a/src/ftp-basic.c
+++ b/src/ftp-basic.c
@@ -43,6 +43,7 @@ as that of the covered work.  */
 #include "host.h"
 #include "ftp.h"
 #include "retr.h"
+#include "c-strcase.h"


 /* Get the response of FTP server and allocate enough room to handle
@@ -190,7 +191,7 @@ ftp_login (int csock, const char *acc, const char *pass)
     for (i = 0; i < countof (skey_head); i++)
       {
         int l = strlen (skey_head[i]);
-        if (0 == strncasecmp (skey_head[i], respline, l))
+        if (0 == c_strncasecmp (skey_head[i], respline, l))
           {
             seed = respline + l;
             break;
@@ -1068,25 +1069,25 @@ ftp_syst (int csock, enum stype *server_type, enum ustype *unix_type)

   if (request == NULL)
     *server_type = ST_OTHER;
-  else if (!strcasecmp (request, "VMS"))
+  else if (!c_strcasecmp (request, "VMS"))
     *server_type = ST_VMS;
-  else if (!strcasecmp (request, "UNIX"))
+  else if (!c_strcasecmp (request, "UNIX"))
     {
       *server_type = ST_UNIX;
       /* 2013-10-17 Andrea Urbani (matfanjol)
          I check more in depth the system type */
-      if (!strncasecmp (ftp_last_respline, "215 UNIX Type: L8", 17))
+      if (!c_strncasecmp (ftp_last_respline, "215 UNIX Type: L8", 17))
         *unix_type = UST_TYPE_L8;
-      else if (!strncasecmp (ftp_last_respline,
+      else if (!c_strncasecmp (ftp_last_respline,
                              "215 UNIX MultiNet Unix Emulation V5.3(93)", 41))
         *unix_type = UST_MULTINET;
     }
-  else if (!strcasecmp (request, "WINDOWS_NT")
-           || !strcasecmp (request, "WINDOWS2000"))
+  else if (!c_strcasecmp (request, "WINDOWS_NT")
+           || !c_strcasecmp (request, "WINDOWS2000"))
     *server_type = ST_WINNT;
-  else if (!strcasecmp (request, "MACOS"))
+  else if (!c_strcasecmp (request, "MACOS"))
     *server_type = ST_MACOS;
-  else if (!strcasecmp (request, "OS/400"))
+  else if (!c_strcasecmp (request, "OS/400"))
     *server_type = ST_OS400;
   else
     *server_type = ST_OTHER;
diff --git a/src/ftp-ls.c b/src/ftp-ls.c
index 8ab8a37..d68380b 100644
--- a/src/ftp-ls.c
+++ b/src/ftp-ls.c
@@ -42,6 +42,7 @@ as that of the covered work.  */
 #include "url.h"
 #include "convert.h"            /* for html_quote_string prototype */
 #include "retr.h"               /* for output_stream */
+#include "c-strcase.h"

 /* Converts symbolic permissions to number-style ones, e.g. string
    rwxr-xr-x to 755.  For now, it knows nothing of
@@ -121,7 +122,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
     {
       len = clean_line (line, len);
       /* Skip if total...  */
-      if (!strncasecmp (line, "total", 5))
+      if (!c_strncasecmp (line, "total", 5))
         continue;
       /* Get the first token (permissions).  */
       tok = strtok (line, " ");
@@ -199,7 +200,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
           if (next < 0)         /* a month name was not encountered */
             {
               for (i = 0; i < 12; i++)
-                if (!strcasecmp (tok, months[i]))
+                if (!c_strcasecmp (tok, months[i]))
                   break;
               /* If we got a month, it means the token before it is the
                  size, and the filename is three tokens away.  */
@@ -775,14 +776,14 @@ ftp_parse_vms_ls (const char *file)
          what will work in a CWD command.
       */
       len = strlen (tok);
-      if (!strncasecmp((tok + (len - 4)), ".DIR", 4))
+      if (!c_strncasecmp((tok + (len - 4)), ".DIR", 4))
         {
           *(tok+ (len - 4)) = '\0'; /* Discard ".DIR". */
           cur.type  = FT_DIRECTORY;
           cur.perms = VMS_DEFAULT_PROT_DIR;
           DEBUGP (("Directory (nv)\n"));
         }
-      else if (!strncasecmp ((tok + (len - 6)), ".DIR;1", 6))
+      else if (!c_strncasecmp ((tok + (len - 6)), ".DIR;1", 6))
         {
           *(tok+ (len - 6)) = '\0'; /* Discard ".DIR;1". */
           cur.type  = FT_DIRECTORY;
diff --git a/src/ftp.c b/src/ftp.c
index d614a27..06ab522 100644
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -50,6 +50,7 @@ as that of the covered work.  */
 #include "convert.h"            /* for downloaded_file */
 #include "recur.h"              /* for INFINITE_RECURSION */
 #include "warc.h"
+#include "c-strcase.h"

 #ifdef __VMS
 # include "vms.h"
@@ -102,7 +103,7 @@ ftp_expected_bytes (const char *s)
         return 0;
       if (c_tolower (*s) != 'b')
         continue;
-      if (strncasecmp (s, "byte", 4))
+      if (c_strncasecmp (s, "byte", 4))
         continue;
       else
         break;
diff --git a/src/html-url.c b/src/html-url.c
index 903864e..32aec77 100644
--- a/src/html-url.c
+++ b/src/html-url.c
@@ -45,6 +45,7 @@ as that of the covered work.  */
 #include "recur.h"
 #include "html-url.h"
 #include "css-url.h"
+#include "c-strcase.h"

 typedef void (*tag_handler_t) (int, struct taginfo *, struct map_context *);

@@ -255,7 +256,7 @@ find_attr (struct taginfo *tag, const char *name, int *attrind)
 {
   int i;
   for (i = 0; i < tag->nattrs; i++)
-    if (!strcasecmp (tag->attrs[i].name, name))
+    if (!c_strcasecmp (tag->attrs[i].name, name))
       {
         if (attrind)
           *attrind = i;
@@ -536,12 +537,12 @@ tag_handle_link (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
           char *rel = find_attr (tag, "rel", NULL);
           if (rel)
             {
-              if (0 == strcasecmp (rel, "stylesheet"))
+              if (0 == c_strcasecmp (rel, "stylesheet"))
                 {
                   up->link_inline_p = 1;
                   up->link_expect_css = 1;
                 }
-              else if (0 == strcasecmp (rel, "shortcut icon"))
+              else if (0 == c_strcasecmp (rel, "shortcut icon"))
                 {
                   up->link_inline_p = 1;
                 }
@@ -553,7 +554,7 @@ tag_handle_link (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
                      <link rel="alternate" type="application/rss+xml" href=".../?feed=rss2" />
                   */
                   char *type = find_attr (tag, "type", NULL);
-                  if (!type || strcasecmp (type, "text/html") == 0)
+                  if (!type || c_strcasecmp (type, "text/html") == 0)
                     up->link_expect_html = 1;
                 }
             }
@@ -570,7 +571,7 @@ tag_handle_meta (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
   char *name = find_attr (tag, "name", NULL);
   char *http_equiv = find_attr (tag, "http-equiv", NULL);

-  if (http_equiv && 0 == strcasecmp (http_equiv, "refresh"))
+  if (http_equiv && 0 == c_strcasecmp (http_equiv, "refresh"))
     {
       /* Some pages use a META tag to specify that the page be
          refreshed by a new page after a given number of seconds.  The
@@ -615,7 +616,7 @@ tag_handle_meta (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
           entry->link_expect_html = 1;
         }
     }
-  else if (http_equiv && 0 == strcasecmp (http_equiv, "content-type"))
+  else if (http_equiv && 0 == c_strcasecmp (http_equiv, "content-type"))
     {
       /* Handle stuff like:
          <meta http-equiv="Content-Type" content="text/html; charset=CHARSET"> */
@@ -632,14 +633,14 @@ tag_handle_meta (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
       xfree_null (meta_charset);
       meta_charset = mcharset;
     }
-  else if (name && 0 == strcasecmp (name, "robots"))
+  else if (name && 0 == c_strcasecmp (name, "robots"))
     {
       /* Handle stuff like:
          <meta name="robots" content="index,nofollow"> */
       char *content = find_attr (tag, "content", NULL);
       if (!content)
         return;
-      if (!strcasecmp (content, "none"))
+      if (!c_strcasecmp (content, "none"))
         ctx->nofollow = true;
       else
         {
@@ -651,7 +652,7 @@ tag_handle_meta (int tagid _GL_UNUSED, struct taginfo *tag, struct map_context *
               /* Find the next occurrence of ',' or whitespace,
                * or the end of the string.  */
               end = content + strcspn (content, ", \f\n\r\t\v");
-              if (!strncasecmp (content, "nofollow", end - content))
+              if (!c_strncasecmp (content, "nofollow", end - content))
                 ctx->nofollow = true;
               /* Skip past the next comma, if any. */
               if (*end == ',')
@@ -692,7 +693,7 @@ collect_tags_mapper (struct taginfo *tag, void *arg)

   check_style_attr (tag, ctx);

-  if (tag->end_tag_p && (0 == strcasecmp (tag->name, "style"))
+  if (tag->end_tag_p && (0 == c_strcasecmp (tag->name, "style"))
       && tag->contents_begin && tag->contents_end
       && tag->contents_begin <= tag->contents_end)
   {
diff --git a/src/http.c b/src/http.c
index da40e98..f82c306 100644
--- a/src/http.c
+++ b/src/http.c
@@ -243,7 +243,7 @@ request_set_header (struct request *req, const char *name, const char *value,
   for (i = 0; i < req->hcount; i++)
     {
       hdr = &req->headers[i];
-      if (0 == strcasecmp (name, hdr->name))
+      if (0 == c_strcasecmp (name, hdr->name))
         {
           /* Replace existing header. */
           release_header (hdr);
@@ -296,7 +296,7 @@ request_remove_header (struct request *req, const char *name)
   for (i = 0; i < req->hcount; i++)
     {
       struct request_header *hdr = &req->headers[i];
-      if (0 == strcasecmp (name, hdr->name))
+      if (0 == c_strcasecmp (name, hdr->name))
         {
           release_header (hdr);
           /* Move the remaining headers by one. */
@@ -681,7 +681,7 @@ resp_header_locate (const struct response *resp, const char *name, int start,
       const char *e = headers[i + 1];
       if (e - b > name_len
           && b[name_len] == ':'
-          && 0 == strncasecmp (b, name, name_len))
+          && 0 == c_strncasecmp (b, name, name_len))
         {
           b += name_len + 1;
           while (b < e && c_isspace (*b))
@@ -1876,9 +1876,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
                               xstrdup (number_to_static_string (body_data_size)),
                               rel_value);
         }
-      else if (strcasecmp (opt.method, "post") == 0
-               || strcasecmp (opt.method, "put") == 0
-               || strcasecmp (opt.method, "patch") == 0)
+      else if (c_strcasecmp (opt.method, "post") == 0
+               || c_strcasecmp (opt.method, "put") == 0
+               || c_strcasecmp (opt.method, "patch") == 0)
         request_set_header (req, "Content-Length", "0", rel_none);
     }

@@ -2297,14 +2297,14 @@ read_header:
     {
       if (resp_header_copy (resp, "Connection", hdrval, sizeof (hdrval)))
         {
-          if (0 == strcasecmp (hdrval, "Close"))
+          if (0 == c_strcasecmp (hdrval, "Close"))
             keep_alive = false;
         }
     }

   chunked_transfer_encoding = false;
   if (resp_header_copy (resp, "Transfer-Encoding", hdrval, sizeof (hdrval))
-      && 0 == strcasecmp (hdrval, "chunked"))
+      && 0 == c_strcasecmp (hdrval, "chunked"))
     chunked_transfer_encoding = true;

   /* Handle (possibly multiple instances of) the Set-Cookie header. */
@@ -2716,11 +2716,11 @@ read_header:
             case HTTP_STATUS_TEMPORARY_REDIRECT:
               return NEWLOCATION_KEEP_POST;
             case HTTP_STATUS_MOVED_PERMANENTLY:
-              if (opt.method && strcasecmp (opt.method, "post") != 0)
+              if (opt.method && c_strcasecmp (opt.method, "post") != 0)
                 return NEWLOCATION_KEEP_POST;
               break;
             case HTTP_STATUS_MOVED_TEMPORARILY:
-              if (opt.method && strcasecmp (opt.method, "post") != 0)
+              if (opt.method && c_strcasecmp (opt.method, "post") != 0)
                 return NEWLOCATION_KEEP_POST;
               break;
             default:
diff --git a/src/init.c b/src/init.c
index e69f6d1..798ee17 100644
--- a/src/init.c
+++ b/src/init.c
@@ -70,6 +70,7 @@ as that of the covered work.  */
 #include "warc.h"               /* for warc_close */
 #include "spider.h"             /* for spider_cleanup */
 #include "html-url.h"           /* for cleanup_html_url */
+#include "c-strcase.h"

 #ifdef TESTING
 #include "test.h"
@@ -320,7 +321,7 @@ command_by_name (const char *cmdname)
   while (lo <= hi)
     {
       int mid = (lo + hi) >> 1;
-      int cmp = strcasecmp (cmdname, commands[mid].name);
+      int cmp = c_strcasecmp (cmdname, commands[mid].name);
       if (cmp < 0)
         hi = mid - 1;
       else if (cmp > 0)
@@ -966,7 +967,7 @@ cmd_number (const char *com, const char *val, void *place)
 static bool
 cmd_number_inf (const char *com, const char *val, void *place)
 {
-  if (!strcasecmp (val, "inf"))
+  if (!c_strcasecmp (val, "inf"))
     {
       *(int *) place = 0;
       return true;
@@ -1518,7 +1519,7 @@ cmd_spec_restrict_file_names (const char *com, const char *val, void *place_igno
 static bool
 cmd_spec_report_speed (const char *com, const char *val, void *place_ignored _GL_UNUSED)
 {
-  opt.report_bps = strcasecmp (val, "bits") == 0;
+  opt.report_bps = c_strcasecmp (val, "bits") == 0;
   if (!opt.report_bps)
     fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
   return opt.report_bps;
@@ -1723,7 +1724,7 @@ decode_string (const char *val, const struct decode_item *items, int itemcount,
 {
   int i;
   for (i = 0; i < itemcount; i++)
-    if (0 == strcasecmp (val, items[i].name))
+    if (0 == c_strcasecmp (val, items[i].name))
       {
         *place = items[i].code;
         return true;
@@ -1828,7 +1829,7 @@ test_commands_sorted(void)

   for (i = 1; i < countof(commands); ++i)
     {
-      if (strcasecmp (commands[i - 1].name, commands[i].name) > 0)
+      if (c_strcasecmp (commands[i - 1].name, commands[i].name) > 0)
         {
           mu_assert ("FAILED", false);
           break;
diff --git a/src/iri.c b/src/iri.c
index dd2806d..d924699 100644
--- a/src/iri.c
+++ b/src/iri.c
@@ -39,6 +39,7 @@ as that of the covered work.  */

 #include "utils.h"
 #include "url.h"
+#include "c-strcase.h"

 /* RFC3987 section 3.1 mandates STD3 ASCII RULES */
 #define IDNA_FLAGS  IDNA_USE_STD3_ASCII_RULES
@@ -206,7 +207,7 @@ locale_to_utf8 (const char *str)
       opt.locale = find_locale ();
     }

-  if (!opt.locale || !strcasecmp (opt.locale, "utf-8"))
+  if (!opt.locale || !c_strcasecmp (opt.locale, "utf-8"))
     return str;

   if (do_conversion ("UTF-8", opt.locale, (char *) str, strlen ((char *) str), &new))
@@ -276,7 +277,7 @@ remote_to_utf8 (struct iri *iri, const char *str, const char **new)
   /* When `i->uri_encoding' == "UTF-8" there is nothing to convert.  But we must
      test for non-ASCII symbols for correct hostname processing in `idn_encode'
      function. */
-  if (!strcasecmp (iri->uri_encoding, "UTF-8"))
+  if (!c_strcasecmp (iri->uri_encoding, "UTF-8"))
     {
       const char *p = str;
       for (p = str; *p; p++)
@@ -344,7 +345,7 @@ set_uri_encoding (struct iri *i, char *charset, bool force)
     return;
   if (i->uri_encoding)
     {
-      if (charset && !strcasecmp (i->uri_encoding, charset))
+      if (charset && !c_strcasecmp (i->uri_encoding, charset))
         return;
       xfree (i->uri_encoding);
     }
@@ -361,7 +362,7 @@ set_content_encoding (struct iri *i, char *charset)
     return;
   if (i->content_encoding)
     {
-      if (charset && !strcasecmp (i->content_encoding, charset))
+      if (charset && !c_strcasecmp (i->content_encoding, charset))
         return;
       xfree (i->content_encoding);
     }
diff --git a/src/main.c b/src/main.c
index d00324d..9119c96 100644
--- a/src/main.c
+++ b/src/main.c
@@ -54,6 +54,7 @@ as that of the covered work.  */
 #include "http.h"               /* for save_cookies */
 #include "ptimer.h"
 #include "warc.h"
+#include "c-strcase.h"
 #include <getopt.h>
 #include <getpass.h>
 #include <quote.h>
@@ -1462,7 +1463,7 @@ for details.\n\n"));

   /* When user specifies HEAD as the method, we do not wish to download any
      files. Hence, set wget to run in spider mode.  */
-  if (opt.method && strcasecmp (opt.method, "HEAD") == 0)
+  if (opt.method && c_strcasecmp (opt.method, "HEAD") == 0)
     setoptval ("spider", "1", "spider");

   /* Convert post_data to body-data and post_file_name to body-file options.
diff --git a/src/progress.c b/src/progress.c
index f813714..81b46c3 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -42,6 +42,7 @@ as that of the covered work.  */
 #include "progress.h"
 #include "utils.h"
 #include "retr.h"
+#include "c-strcase.h"

 struct progress_implementation {
   const char *name;
@@ -427,7 +428,7 @@ dot_set_params (char *params)
     return;

   /* We use this to set the retrieval style.  */
-  if (!strcasecmp (params, "default"))
+  if (!c_strcasecmp (params, "default"))
     {
       /* Default style: 1K dots, 10 dots in a cluster, 50 dots in a
          line.  */
@@ -435,7 +436,7 @@ dot_set_params (char *params)
       opt.dot_spacing = 10;
       opt.dots_in_line = 50;
     }
-  else if (!strcasecmp (params, "binary"))
+  else if (!c_strcasecmp (params, "binary"))
     {
       /* "Binary" retrieval: 8K dots, 16 dots in a cluster, 48 dots
          (384K) in a line.  */
@@ -443,7 +444,7 @@ dot_set_params (char *params)
       opt.dot_spacing = 16;
       opt.dots_in_line = 48;
     }
-  else if (!strcasecmp (params, "mega"))
+  else if (!c_strcasecmp (params, "mega"))
     {
       /* "Mega" retrieval, for retrieving very long files; each dot is
          64K, 8 dots in a cluster, 6 clusters (3M) in a line.  */
@@ -451,7 +452,7 @@ dot_set_params (char *params)
       opt.dot_spacing = 8;
       opt.dots_in_line = 48;
     }
-  else if (!strcasecmp (params, "giga"))
+  else if (!c_strcasecmp (params, "giga"))
     {
       /* "Giga" retrieval, for retrieving very very *very* long files;
          each dot is 1M, 8 dots in a cluster, 4 clusters (32M) in a
diff --git a/src/res.c b/src/res.c
index 1c74481..4af31bf 100644
--- a/src/res.c
+++ b/src/res.c
@@ -81,6 +81,7 @@ as that of the covered work.  */
 #include "url.h"
 #include "retr.h"
 #include "res.h"
+#include "c-strcase.h"

 #ifdef TESTING
 #include "test.h"
diff --git a/src/url.c b/src/url.c
index 3e1f664..7c8721f 100644
--- a/src/url.c
+++ b/src/url.c
@@ -41,6 +41,7 @@ as that of the covered work.  */
 #include "utils.h"
 #include "url.h"
 #include "host.h"  /* for is_valid_ipv6_address */
+#include "c-strcase.h"

 #ifdef __VMS
 #include "vms.h"
@@ -956,7 +957,7 @@ url_error (const char *url, int error_code)

       if ((p = strchr (scheme, ':')))
         *p = '\0';
-      if (!strcasecmp (scheme, "https"))
+      if (!c_strcasecmp (scheme, "https"))
         error = aprintf (_("HTTPS support not compiled in"));
       else
         error = aprintf (_(parse_errors[error_code]), quote (scheme));
diff --git a/src/utils.c b/src/utils.c
index 3280294..b10f56b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -99,6 +99,7 @@ as that of the covered work.  */
 #endif

 #include "exits.h"
+#include "c-strcase.h"

 static void _Noreturn
 memfatal (const char *context, long attempted_size)
@@ -1121,11 +1122,11 @@ has_html_suffix_p (const char *fname)

   if ((suf = suffix (fname)) == NULL)
     return false;
-  if (!strcasecmp (suf, "html"))
+  if (!c_strcasecmp (suf, "html"))
     return true;
-  if (!strcasecmp (suf, "htm"))
+  if (!c_strcasecmp (suf, "htm"))
     return true;
-  if (suf[0] && !strcasecmp (suf + 1, "html"))
+  if (suf[0] && !c_strcasecmp (suf + 1, "html"))
     return true;
   return false;
 }
diff --git a/src/wget.h b/src/wget.h
index 34b8c0c..fa4b439 100644
--- a/src/wget.h
+++ b/src/wget.h
@@ -266,7 +266,7 @@ typedef double SUM_SIZE_INT;
 /* The same as above, except the comparison is case-insensitive. */
 #define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal)         \
   ((end) - (beg) == sizeof (string_literal) - 1                 \
-   && !strncasecmp (beg, string_literal, sizeof (string_literal) - 1))
+   && !c_strncasecmp (beg, string_literal, sizeof (string_literal) - 1))

 /* Like ptr=strdup(str), but allocates the space for PTR on the stack.
    This cannot be an expression because this is not portable:
diff --git a/testenv/ChangeLog b/testenv/ChangeLog
index f230ac6..62e0617 100644
--- a/testenv/ChangeLog
+++ b/testenv/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-18  Tim Ruehsen <[email protected]>
+
+	* Test-Content-disposition-2.py, Test-cookie-expires.py,
+          Test-cookie-domain-mismatch.py: Use uppercase 'I' to
+          provoke Wget failures with turkish locales
+
 2014-11-17  Tim Ruehsen <[email protected]>

 	* server/http/http_server.py: allow case-insensitive auth-type,
diff --git a/testenv/Test-Content-disposition-2.py b/testenv/Test-Content-disposition-2.py
index 5b9cf91..44ea77d 100755
--- a/testenv/Test-Content-disposition-2.py
+++ b/testenv/Test-Content-disposition-2.py
@@ -12,9 +12,10 @@ TEST_NAME = "Content Disposition Clobber"
 File1 = "Teapot"
 File2 = "The Teapot Protocol"

+# use upper case 'I' to provoke Wget failure with turkish locale
 File2_rules = {
     "SendHeader"        : {
-        "Content-Disposition" : "Attachment; filename=HTTP.Teapot"
+        "Content-DIsposition" : "Attachment; FILENAME=HTTP.Teapot"
     }
 }
 A_File = WgetFile ("HTTP.Teapot", File1)
diff --git a/testenv/Test-cookie-domain-mismatch.py b/testenv/Test-cookie-domain-mismatch.py
index 45c5f1d..05b3289 100755
--- a/testenv/Test-cookie-domain-mismatch.py
+++ b/testenv/Test-cookie-domain-mismatch.py
@@ -14,7 +14,8 @@ File2 = "Anyone for chocochip cookies?"

 File1_rules = {
     "SendHeader"        : {
-        "Set-Cookie"    : "sess-id13; path=/; domain=.example.com"
+        # use upper case 'I' to provoke Wget failure with turkish locale
+        "Set-Cookie"    : "sess-id13; path=/; DoMAIn=.example.com"
     }
 }
 File2_rules = {
diff --git a/testenv/Test-cookie-expires.py b/testenv/Test-cookie-expires.py
index 7ad919d..0624549 100755
--- a/testenv/Test-cookie-expires.py
+++ b/testenv/Test-cookie-expires.py
@@ -30,7 +30,8 @@ File2_rules = {
 }
 File3_rules = {
     "SendHeader"        : {
-        "Set-Cookie"    : "sess-id13; path=/; Expires=Sun, 06 Nov 2001 12:32:43 GMT"
+        # use upper case 'I' to provoke Wget failure with turkish locale
+        "Set-Cookie"    : "sess-id13; path=/; ExPIRes=Sun, 06 Nov 2001 12:32:43 GMT"
     },
     "ExpectHeader"      : {
         "Cookie"        : "new-sess=N; sess-id13"
--
2.1.3

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to