mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Fixes possible issues with Wget running in a turkish locale
This commit is contained in:
parent
1356e90a14
commit
7b43510fe3
@ -1,3 +1,19 @@
|
|||||||
|
2014-11-20 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||||
|
|
||||||
|
* 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-20 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||||
|
|
||||||
|
* cookies.c, ftp-basic.c, ftp.c, gnutls.c, host.c,
|
||||||
|
html-url.c, http.c, main.c, progress.c, retr.c, warc.c:
|
||||||
|
Trivial fixes for C89 compliancy.
|
||||||
|
|
||||||
2014-11-19 Darshit Shah <darnir@gmail.com>
|
2014-11-19 Darshit Shah <darnir@gmail.com>
|
||||||
|
|
||||||
* main.c (format_and_print_line): Fix potential memory leak
|
* main.c (format_and_print_line): Fix potential memory leak
|
||||||
|
@ -58,7 +58,9 @@ as that of the covered work. */
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "cookies.h"
|
#include "cookies.h"
|
||||||
#include "http.h" /* for http_atotm */
|
#include "http.h" /* for http_atotm */
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
|
|
||||||
/* Declarations of `struct cookie' and the most basic functions. */
|
/* Declarations of `struct cookie' and the most basic functions. */
|
||||||
|
|
||||||
/* Cookie jar serves as cookie storage and a means of retrieving
|
/* Cookie jar serves as cookie storage and a means of retrieving
|
||||||
|
@ -43,6 +43,7 @@ as that of the covered work. */
|
|||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
#include "retr.h"
|
#include "retr.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
|
|
||||||
/* Get the response of FTP server and allocate enough room to handle
|
/* 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++)
|
for (i = 0; i < countof (skey_head); i++)
|
||||||
{
|
{
|
||||||
int l = strlen (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;
|
seed = respline + l;
|
||||||
break;
|
break;
|
||||||
@ -1068,25 +1069,25 @@ ftp_syst (int csock, enum stype *server_type, enum ustype *unix_type)
|
|||||||
|
|
||||||
if (request == NULL)
|
if (request == NULL)
|
||||||
*server_type = ST_OTHER;
|
*server_type = ST_OTHER;
|
||||||
else if (!strcasecmp (request, "VMS"))
|
else if (!c_strcasecmp (request, "VMS"))
|
||||||
*server_type = ST_VMS;
|
*server_type = ST_VMS;
|
||||||
else if (!strcasecmp (request, "UNIX"))
|
else if (!c_strcasecmp (request, "UNIX"))
|
||||||
{
|
{
|
||||||
*server_type = ST_UNIX;
|
*server_type = ST_UNIX;
|
||||||
/* 2013-10-17 Andrea Urbani (matfanjol)
|
/* 2013-10-17 Andrea Urbani (matfanjol)
|
||||||
I check more in depth the system type */
|
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;
|
*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))
|
"215 UNIX MultiNet Unix Emulation V5.3(93)", 41))
|
||||||
*unix_type = UST_MULTINET;
|
*unix_type = UST_MULTINET;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp (request, "WINDOWS_NT")
|
else if (!c_strcasecmp (request, "WINDOWS_NT")
|
||||||
|| !strcasecmp (request, "WINDOWS2000"))
|
|| !c_strcasecmp (request, "WINDOWS2000"))
|
||||||
*server_type = ST_WINNT;
|
*server_type = ST_WINNT;
|
||||||
else if (!strcasecmp (request, "MACOS"))
|
else if (!c_strcasecmp (request, "MACOS"))
|
||||||
*server_type = ST_MACOS;
|
*server_type = ST_MACOS;
|
||||||
else if (!strcasecmp (request, "OS/400"))
|
else if (!c_strcasecmp (request, "OS/400"))
|
||||||
*server_type = ST_OS400;
|
*server_type = ST_OS400;
|
||||||
else
|
else
|
||||||
*server_type = ST_OTHER;
|
*server_type = ST_OTHER;
|
||||||
|
@ -42,6 +42,7 @@ as that of the covered work. */
|
|||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "convert.h" /* for html_quote_string prototype */
|
#include "convert.h" /* for html_quote_string prototype */
|
||||||
#include "retr.h" /* for output_stream */
|
#include "retr.h" /* for output_stream */
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
/* Converts symbolic permissions to number-style ones, e.g. string
|
/* Converts symbolic permissions to number-style ones, e.g. string
|
||||||
rwxr-xr-x to 755. For now, it knows nothing of
|
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);
|
len = clean_line (line, len);
|
||||||
/* Skip if total... */
|
/* Skip if total... */
|
||||||
if (!strncasecmp (line, "total", 5))
|
if (!c_strncasecmp (line, "total", 5))
|
||||||
continue;
|
continue;
|
||||||
/* Get the first token (permissions). */
|
/* Get the first token (permissions). */
|
||||||
tok = strtok (line, " ");
|
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 */
|
if (next < 0) /* a month name was not encountered */
|
||||||
{
|
{
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
if (!strcasecmp (tok, months[i]))
|
if (!c_strcasecmp (tok, months[i]))
|
||||||
break;
|
break;
|
||||||
/* If we got a month, it means the token before it is the
|
/* If we got a month, it means the token before it is the
|
||||||
size, and the filename is three tokens away. */
|
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.
|
what will work in a CWD command.
|
||||||
*/
|
*/
|
||||||
len = strlen (tok);
|
len = strlen (tok);
|
||||||
if (!strncasecmp((tok + (len - 4)), ".DIR", 4))
|
if (!c_strncasecmp((tok + (len - 4)), ".DIR", 4))
|
||||||
{
|
{
|
||||||
*(tok+ (len - 4)) = '\0'; /* Discard ".DIR". */
|
*(tok+ (len - 4)) = '\0'; /* Discard ".DIR". */
|
||||||
cur.type = FT_DIRECTORY;
|
cur.type = FT_DIRECTORY;
|
||||||
cur.perms = VMS_DEFAULT_PROT_DIR;
|
cur.perms = VMS_DEFAULT_PROT_DIR;
|
||||||
DEBUGP (("Directory (nv)\n"));
|
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". */
|
*(tok+ (len - 6)) = '\0'; /* Discard ".DIR;1". */
|
||||||
cur.type = FT_DIRECTORY;
|
cur.type = FT_DIRECTORY;
|
||||||
|
@ -50,6 +50,7 @@ as that of the covered work. */
|
|||||||
#include "convert.h" /* for downloaded_file */
|
#include "convert.h" /* for downloaded_file */
|
||||||
#include "recur.h" /* for INFINITE_RECURSION */
|
#include "recur.h" /* for INFINITE_RECURSION */
|
||||||
#include "warc.h"
|
#include "warc.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
# include "vms.h"
|
# include "vms.h"
|
||||||
@ -102,7 +103,7 @@ ftp_expected_bytes (const char *s)
|
|||||||
return 0;
|
return 0;
|
||||||
if (c_tolower (*s) != 'b')
|
if (c_tolower (*s) != 'b')
|
||||||
continue;
|
continue;
|
||||||
if (strncasecmp (s, "byte", 4))
|
if (c_strncasecmp (s, "byte", 4))
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@ -45,6 +45,7 @@ as that of the covered work. */
|
|||||||
#include "recur.h"
|
#include "recur.h"
|
||||||
#include "html-url.h"
|
#include "html-url.h"
|
||||||
#include "css-url.h"
|
#include "css-url.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
typedef void (*tag_handler_t) (int, struct taginfo *, struct map_context *);
|
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;
|
int i;
|
||||||
for (i = 0; i < tag->nattrs; 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)
|
if (attrind)
|
||||||
*attrind = i;
|
*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);
|
char *rel = find_attr (tag, "rel", NULL);
|
||||||
if (rel)
|
if (rel)
|
||||||
{
|
{
|
||||||
if (0 == strcasecmp (rel, "stylesheet"))
|
if (0 == c_strcasecmp (rel, "stylesheet"))
|
||||||
{
|
{
|
||||||
up->link_inline_p = 1;
|
up->link_inline_p = 1;
|
||||||
up->link_expect_css = 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;
|
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" />
|
<link rel="alternate" type="application/rss+xml" href=".../?feed=rss2" />
|
||||||
*/
|
*/
|
||||||
char *type = find_attr (tag, "type", NULL);
|
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;
|
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 *name = find_attr (tag, "name", NULL);
|
||||||
char *http_equiv = find_attr (tag, "http-equiv", 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
|
/* Some pages use a META tag to specify that the page be
|
||||||
refreshed by a new page after a given number of seconds. The
|
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;
|
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:
|
/* Handle stuff like:
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=CHARSET"> */
|
<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);
|
xfree_null (meta_charset);
|
||||||
meta_charset = mcharset;
|
meta_charset = mcharset;
|
||||||
}
|
}
|
||||||
else if (name && 0 == strcasecmp (name, "robots"))
|
else if (name && 0 == c_strcasecmp (name, "robots"))
|
||||||
{
|
{
|
||||||
/* Handle stuff like:
|
/* Handle stuff like:
|
||||||
<meta name="robots" content="index,nofollow"> */
|
<meta name="robots" content="index,nofollow"> */
|
||||||
char *content = find_attr (tag, "content", NULL);
|
char *content = find_attr (tag, "content", NULL);
|
||||||
if (!content)
|
if (!content)
|
||||||
return;
|
return;
|
||||||
if (!strcasecmp (content, "none"))
|
if (!c_strcasecmp (content, "none"))
|
||||||
ctx->nofollow = true;
|
ctx->nofollow = true;
|
||||||
else
|
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,
|
/* Find the next occurrence of ',' or whitespace,
|
||||||
* or the end of the string. */
|
* or the end of the string. */
|
||||||
end = content + strcspn (content, ", \f\n\r\t\v");
|
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;
|
ctx->nofollow = true;
|
||||||
/* Skip past the next comma, if any. */
|
/* Skip past the next comma, if any. */
|
||||||
if (*end == ',')
|
if (*end == ',')
|
||||||
@ -692,7 +693,7 @@ collect_tags_mapper (struct taginfo *tag, void *arg)
|
|||||||
|
|
||||||
check_style_attr (tag, ctx);
|
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
|
||||||
&& tag->contents_begin <= tag->contents_end)
|
&& tag->contents_begin <= tag->contents_end)
|
||||||
{
|
{
|
||||||
|
20
src/http.c
20
src/http.c
@ -244,7 +244,7 @@ request_set_header (struct request *req, const char *name, const char *value,
|
|||||||
for (i = 0; i < req->hcount; i++)
|
for (i = 0; i < req->hcount; i++)
|
||||||
{
|
{
|
||||||
hdr = &req->headers[i];
|
hdr = &req->headers[i];
|
||||||
if (0 == strcasecmp (name, hdr->name))
|
if (0 == c_strcasecmp (name, hdr->name))
|
||||||
{
|
{
|
||||||
/* Replace existing header. */
|
/* Replace existing header. */
|
||||||
release_header (hdr);
|
release_header (hdr);
|
||||||
@ -297,7 +297,7 @@ request_remove_header (struct request *req, const char *name)
|
|||||||
for (i = 0; i < req->hcount; i++)
|
for (i = 0; i < req->hcount; i++)
|
||||||
{
|
{
|
||||||
struct request_header *hdr = &req->headers[i];
|
struct request_header *hdr = &req->headers[i];
|
||||||
if (0 == strcasecmp (name, hdr->name))
|
if (0 == c_strcasecmp (name, hdr->name))
|
||||||
{
|
{
|
||||||
release_header (hdr);
|
release_header (hdr);
|
||||||
/* Move the remaining headers by one. */
|
/* Move the remaining headers by one. */
|
||||||
@ -682,7 +682,7 @@ resp_header_locate (const struct response *resp, const char *name, int start,
|
|||||||
const char *e = headers[i + 1];
|
const char *e = headers[i + 1];
|
||||||
if (e - b > name_len
|
if (e - b > name_len
|
||||||
&& b[name_len] == ':'
|
&& b[name_len] == ':'
|
||||||
&& 0 == strncasecmp (b, name, name_len))
|
&& 0 == c_strncasecmp (b, name, name_len))
|
||||||
{
|
{
|
||||||
b += name_len + 1;
|
b += name_len + 1;
|
||||||
while (b < e && c_isspace (*b))
|
while (b < e && c_isspace (*b))
|
||||||
@ -1877,9 +1877,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
|
|||||||
xstrdup (number_to_static_string (body_data_size)),
|
xstrdup (number_to_static_string (body_data_size)),
|
||||||
rel_value);
|
rel_value);
|
||||||
}
|
}
|
||||||
else if (strcasecmp (opt.method, "post") == 0
|
else if (c_strcasecmp (opt.method, "post") == 0
|
||||||
|| strcasecmp (opt.method, "put") == 0
|
|| c_strcasecmp (opt.method, "put") == 0
|
||||||
|| strcasecmp (opt.method, "patch") == 0)
|
|| c_strcasecmp (opt.method, "patch") == 0)
|
||||||
request_set_header (req, "Content-Length", "0", rel_none);
|
request_set_header (req, "Content-Length", "0", rel_none);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2300,14 +2300,14 @@ read_header:
|
|||||||
{
|
{
|
||||||
if (resp_header_copy (resp, "Connection", hdrval, sizeof (hdrval)))
|
if (resp_header_copy (resp, "Connection", hdrval, sizeof (hdrval)))
|
||||||
{
|
{
|
||||||
if (0 == strcasecmp (hdrval, "Close"))
|
if (0 == c_strcasecmp (hdrval, "Close"))
|
||||||
keep_alive = false;
|
keep_alive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chunked_transfer_encoding = false;
|
chunked_transfer_encoding = false;
|
||||||
if (resp_header_copy (resp, "Transfer-Encoding", hdrval, sizeof (hdrval))
|
if (resp_header_copy (resp, "Transfer-Encoding", hdrval, sizeof (hdrval))
|
||||||
&& 0 == strcasecmp (hdrval, "chunked"))
|
&& 0 == c_strcasecmp (hdrval, "chunked"))
|
||||||
chunked_transfer_encoding = true;
|
chunked_transfer_encoding = true;
|
||||||
|
|
||||||
/* Handle (possibly multiple instances of) the Set-Cookie header. */
|
/* Handle (possibly multiple instances of) the Set-Cookie header. */
|
||||||
@ -2737,11 +2737,11 @@ read_header:
|
|||||||
case HTTP_STATUS_TEMPORARY_REDIRECT:
|
case HTTP_STATUS_TEMPORARY_REDIRECT:
|
||||||
return NEWLOCATION_KEEP_POST;
|
return NEWLOCATION_KEEP_POST;
|
||||||
case HTTP_STATUS_MOVED_PERMANENTLY:
|
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;
|
return NEWLOCATION_KEEP_POST;
|
||||||
break;
|
break;
|
||||||
case HTTP_STATUS_MOVED_TEMPORARILY:
|
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;
|
return NEWLOCATION_KEEP_POST;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
11
src/init.c
11
src/init.c
@ -70,6 +70,7 @@ as that of the covered work. */
|
|||||||
#include "warc.h" /* for warc_close */
|
#include "warc.h" /* for warc_close */
|
||||||
#include "spider.h" /* for spider_cleanup */
|
#include "spider.h" /* for spider_cleanup */
|
||||||
#include "html-url.h" /* for cleanup_html_url */
|
#include "html-url.h" /* for cleanup_html_url */
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
@ -320,7 +321,7 @@ command_by_name (const char *cmdname)
|
|||||||
while (lo <= hi)
|
while (lo <= hi)
|
||||||
{
|
{
|
||||||
int mid = (lo + hi) >> 1;
|
int mid = (lo + hi) >> 1;
|
||||||
int cmp = strcasecmp (cmdname, commands[mid].name);
|
int cmp = c_strcasecmp (cmdname, commands[mid].name);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
hi = mid - 1;
|
hi = mid - 1;
|
||||||
else if (cmp > 0)
|
else if (cmp > 0)
|
||||||
@ -966,7 +967,7 @@ cmd_number (const char *com, const char *val, void *place)
|
|||||||
static bool
|
static bool
|
||||||
cmd_number_inf (const char *com, const char *val, void *place)
|
cmd_number_inf (const char *com, const char *val, void *place)
|
||||||
{
|
{
|
||||||
if (!strcasecmp (val, "inf"))
|
if (!c_strcasecmp (val, "inf"))
|
||||||
{
|
{
|
||||||
*(int *) place = 0;
|
*(int *) place = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -1518,7 +1519,7 @@ cmd_spec_restrict_file_names (const char *com, const char *val, void *place_igno
|
|||||||
static bool
|
static bool
|
||||||
cmd_spec_report_speed (const char *com, const char *val, void *place_ignored _GL_UNUSED)
|
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)
|
if (!opt.report_bps)
|
||||||
fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
|
fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
|
||||||
return opt.report_bps;
|
return opt.report_bps;
|
||||||
@ -1723,7 +1724,7 @@ decode_string (const char *val, const struct decode_item *items, int itemcount,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < itemcount; 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;
|
*place = items[i].code;
|
||||||
return true;
|
return true;
|
||||||
@ -1828,7 +1829,7 @@ test_commands_sorted(void)
|
|||||||
|
|
||||||
for (i = 1; i < countof(commands); ++i)
|
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);
|
mu_assert ("FAILED", false);
|
||||||
break;
|
break;
|
||||||
|
@ -39,6 +39,7 @@ as that of the covered work. */
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
/* RFC3987 section 3.1 mandates STD3 ASCII RULES */
|
/* RFC3987 section 3.1 mandates STD3 ASCII RULES */
|
||||||
#define IDNA_FLAGS IDNA_USE_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 ();
|
opt.locale = find_locale ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opt.locale || !strcasecmp (opt.locale, "utf-8"))
|
if (!opt.locale || !c_strcasecmp (opt.locale, "utf-8"))
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
if (do_conversion ("UTF-8", opt.locale, (char *) str, strlen ((char *) str), &new))
|
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
|
/* 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'
|
test for non-ASCII symbols for correct hostname processing in `idn_encode'
|
||||||
function. */
|
function. */
|
||||||
if (!strcasecmp (iri->uri_encoding, "UTF-8"))
|
if (!c_strcasecmp (iri->uri_encoding, "UTF-8"))
|
||||||
{
|
{
|
||||||
const char *p = str;
|
const char *p = str;
|
||||||
for (p = str; *p; p++)
|
for (p = str; *p; p++)
|
||||||
@ -344,7 +345,7 @@ set_uri_encoding (struct iri *i, char *charset, bool force)
|
|||||||
return;
|
return;
|
||||||
if (i->uri_encoding)
|
if (i->uri_encoding)
|
||||||
{
|
{
|
||||||
if (charset && !strcasecmp (i->uri_encoding, charset))
|
if (charset && !c_strcasecmp (i->uri_encoding, charset))
|
||||||
return;
|
return;
|
||||||
xfree (i->uri_encoding);
|
xfree (i->uri_encoding);
|
||||||
}
|
}
|
||||||
@ -361,7 +362,7 @@ set_content_encoding (struct iri *i, char *charset)
|
|||||||
return;
|
return;
|
||||||
if (i->content_encoding)
|
if (i->content_encoding)
|
||||||
{
|
{
|
||||||
if (charset && !strcasecmp (i->content_encoding, charset))
|
if (charset && !c_strcasecmp (i->content_encoding, charset))
|
||||||
return;
|
return;
|
||||||
xfree (i->content_encoding);
|
xfree (i->content_encoding);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ as that of the covered work. */
|
|||||||
#include "http.h" /* for save_cookies */
|
#include "http.h" /* for save_cookies */
|
||||||
#include "ptimer.h"
|
#include "ptimer.h"
|
||||||
#include "warc.h"
|
#include "warc.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <getpass.h>
|
#include <getpass.h>
|
||||||
#include <quote.h>
|
#include <quote.h>
|
||||||
@ -1466,7 +1467,7 @@ for details.\n\n"));
|
|||||||
|
|
||||||
/* When user specifies HEAD as the method, we do not wish to download any
|
/* When user specifies HEAD as the method, we do not wish to download any
|
||||||
files. Hence, set wget to run in spider mode. */
|
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");
|
setoptval ("spider", "1", "spider");
|
||||||
|
|
||||||
/* Convert post_data to body-data and post_file_name to body-file options.
|
/* Convert post_data to body-data and post_file_name to body-file options.
|
||||||
|
@ -42,6 +42,7 @@ as that of the covered work. */
|
|||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "retr.h"
|
#include "retr.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
struct progress_implementation {
|
struct progress_implementation {
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -427,7 +428,7 @@ dot_set_params (char *params)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* We use this to set the retrieval style. */
|
/* 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
|
/* Default style: 1K dots, 10 dots in a cluster, 50 dots in a
|
||||||
line. */
|
line. */
|
||||||
@ -435,7 +436,7 @@ dot_set_params (char *params)
|
|||||||
opt.dot_spacing = 10;
|
opt.dot_spacing = 10;
|
||||||
opt.dots_in_line = 50;
|
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
|
/* "Binary" retrieval: 8K dots, 16 dots in a cluster, 48 dots
|
||||||
(384K) in a line. */
|
(384K) in a line. */
|
||||||
@ -443,7 +444,7 @@ dot_set_params (char *params)
|
|||||||
opt.dot_spacing = 16;
|
opt.dot_spacing = 16;
|
||||||
opt.dots_in_line = 48;
|
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
|
/* "Mega" retrieval, for retrieving very long files; each dot is
|
||||||
64K, 8 dots in a cluster, 6 clusters (3M) in a line. */
|
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.dot_spacing = 8;
|
||||||
opt.dots_in_line = 48;
|
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;
|
/* "Giga" retrieval, for retrieving very very *very* long files;
|
||||||
each dot is 1M, 8 dots in a cluster, 4 clusters (32M) in a
|
each dot is 1M, 8 dots in a cluster, 4 clusters (32M) in a
|
||||||
|
@ -81,6 +81,7 @@ as that of the covered work. */
|
|||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "retr.h"
|
#include "retr.h"
|
||||||
#include "res.h"
|
#include "res.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
#ifdef TESTING
|
#ifdef TESTING
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
@ -41,6 +41,7 @@ as that of the covered work. */
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "host.h" /* for is_valid_ipv6_address */
|
#include "host.h" /* for is_valid_ipv6_address */
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
#include "vms.h"
|
#include "vms.h"
|
||||||
@ -956,7 +957,7 @@ url_error (const char *url, int error_code)
|
|||||||
|
|
||||||
if ((p = strchr (scheme, ':')))
|
if ((p = strchr (scheme, ':')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (!strcasecmp (scheme, "https"))
|
if (!c_strcasecmp (scheme, "https"))
|
||||||
error = aprintf (_("HTTPS support not compiled in"));
|
error = aprintf (_("HTTPS support not compiled in"));
|
||||||
else
|
else
|
||||||
error = aprintf (_(parse_errors[error_code]), quote (scheme));
|
error = aprintf (_(parse_errors[error_code]), quote (scheme));
|
||||||
|
@ -99,6 +99,7 @@ as that of the covered work. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "exits.h"
|
#include "exits.h"
|
||||||
|
#include "c-strcase.h"
|
||||||
|
|
||||||
static void _Noreturn
|
static void _Noreturn
|
||||||
memfatal (const char *context, long attempted_size)
|
memfatal (const char *context, long attempted_size)
|
||||||
@ -1121,11 +1122,11 @@ has_html_suffix_p (const char *fname)
|
|||||||
|
|
||||||
if ((suf = suffix (fname)) == NULL)
|
if ((suf = suffix (fname)) == NULL)
|
||||||
return false;
|
return false;
|
||||||
if (!strcasecmp (suf, "html"))
|
if (!c_strcasecmp (suf, "html"))
|
||||||
return true;
|
return true;
|
||||||
if (!strcasecmp (suf, "htm"))
|
if (!c_strcasecmp (suf, "htm"))
|
||||||
return true;
|
return true;
|
||||||
if (suf[0] && !strcasecmp (suf + 1, "html"))
|
if (suf[0] && !c_strcasecmp (suf + 1, "html"))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ typedef double SUM_SIZE_INT;
|
|||||||
/* The same as above, except the comparison is case-insensitive. */
|
/* The same as above, except the comparison is case-insensitive. */
|
||||||
#define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal) \
|
#define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal) \
|
||||||
((end) - (beg) == sizeof (string_literal) - 1 \
|
((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.
|
/* Like ptr=strdup(str), but allocates the space for PTR on the stack.
|
||||||
This cannot be an expression because this is not portable:
|
This cannot be an expression because this is not portable:
|
||||||
|
@ -12,9 +12,10 @@ TEST_NAME = "Content Disposition Clobber"
|
|||||||
File1 = "Teapot"
|
File1 = "Teapot"
|
||||||
File2 = "The Teapot Protocol"
|
File2 = "The Teapot Protocol"
|
||||||
|
|
||||||
|
# use upper case 'I' to provoke Wget failure with turkish locale
|
||||||
File2_rules = {
|
File2_rules = {
|
||||||
"SendHeader" : {
|
"SendHeader" : {
|
||||||
"Content-Disposition" : "Attachment; filename=HTTP.Teapot"
|
"Content-DIsposition" : "Attachment; FILENAME=HTTP.Teapot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
A_File = WgetFile ("HTTP.Teapot", File1)
|
A_File = WgetFile ("HTTP.Teapot", File1)
|
||||||
|
@ -14,7 +14,8 @@ File2 = "Anyone for chocochip cookies?"
|
|||||||
|
|
||||||
File1_rules = {
|
File1_rules = {
|
||||||
"SendHeader" : {
|
"SendHeader" : {
|
||||||
"Set-Cookie" : "sess-id=0213; path=/; domain=.example.com"
|
# use upper case 'I' to provoke Wget failure with turkish locale
|
||||||
|
"Set-Cookie" : "sess-id=0213; path=/; DoMAIn=.example.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File2_rules = {
|
File2_rules = {
|
||||||
|
@ -30,7 +30,8 @@ File2_rules = {
|
|||||||
}
|
}
|
||||||
File3_rules = {
|
File3_rules = {
|
||||||
"SendHeader" : {
|
"SendHeader" : {
|
||||||
"Set-Cookie" : "sess-id=0213; path=/; Expires=Sun, 06 Nov 2001 12:32:43 GMT"
|
# use upper case 'I' to provoke Wget failure with turkish locale
|
||||||
|
"Set-Cookie" : "sess-id=0213; path=/; ExPIRes=Sun, 06 Nov 2001 12:32:43 GMT"
|
||||||
},
|
},
|
||||||
"ExpectHeader" : {
|
"ExpectHeader" : {
|
||||||
"Cookie" : "new-sess=N; sess-id=0213"
|
"Cookie" : "new-sess=N; sess-id=0213"
|
||||||
|
Loading…
Reference in New Issue
Block a user