mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
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.
This commit is contained in:
parent
502acba2af
commit
811a693b80
@ -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 \
|
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 \
|
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 \
|
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 \
|
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 \
|
pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c \
|
||||||
openldap.c curl_gethostname.c gopher.c idn_win32.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 \
|
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 \
|
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 \
|
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 \
|
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 \
|
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 \
|
curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h \
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "conncache.h"
|
#include "conncache.h"
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
|
30
lib/cookie.c
30
lib/cookie.c
@ -95,7 +95,7 @@ Example set of cookies:
|
|||||||
#include "slist.h"
|
#include "slist.h"
|
||||||
#include "share.h"
|
#include "share.h"
|
||||||
#include "strtoofft.h"
|
#include "strtoofft.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "curl_memrchr.h"
|
#include "curl_memrchr.h"
|
||||||
#include "inet_pton.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)
|
if(hostname_len < cookie_domain_len)
|
||||||
return FALSE;
|
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;
|
return FALSE;
|
||||||
|
|
||||||
/* A lead char of cookie_domain is not '.'.
|
/* 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
|
/* this was a "<name>=" with no content, and we must allow
|
||||||
'secure' and 'httponly' specified this weirdly */
|
'secure' and 'httponly' specified this weirdly */
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
if(Curl_raw_equal("secure", name))
|
if(strcasecompare("secure", name))
|
||||||
co->secure = TRUE;
|
co->secure = TRUE;
|
||||||
else if(Curl_raw_equal("httponly", name))
|
else if(strcasecompare("httponly", name))
|
||||||
co->httponly = TRUE;
|
co->httponly = TRUE;
|
||||||
else if(sep)
|
else if(sep)
|
||||||
/* there was a '=' so we're not done parsing this field */
|
/* there was a '=' so we're not done parsing this field */
|
||||||
@ -478,7 +478,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
if(done)
|
if(done)
|
||||||
;
|
;
|
||||||
else if(Curl_raw_equal("path", name)) {
|
else if(strcasecompare("path", name)) {
|
||||||
strstore(&co->path, whatptr);
|
strstore(&co->path, whatptr);
|
||||||
if(!co->path) {
|
if(!co->path) {
|
||||||
badcookie = TRUE; /* out of memory bad */
|
badcookie = TRUE; /* out of memory bad */
|
||||||
@ -490,7 +490,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("domain", name)) {
|
else if(strcasecompare("domain", name)) {
|
||||||
bool is_ip;
|
bool is_ip;
|
||||||
const char *dotp;
|
const char *dotp;
|
||||||
|
|
||||||
@ -528,14 +528,14 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
whatptr);
|
whatptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("version", name)) {
|
else if(strcasecompare("version", name)) {
|
||||||
strstore(&co->version, whatptr);
|
strstore(&co->version, whatptr);
|
||||||
if(!co->version) {
|
if(!co->version) {
|
||||||
badcookie = TRUE;
|
badcookie = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("max-age", name)) {
|
else if(strcasecompare("max-age", name)) {
|
||||||
/* Defined in RFC2109:
|
/* Defined in RFC2109:
|
||||||
|
|
||||||
Optional. The Max-Age attribute defines the lifetime of the
|
Optional. The Max-Age attribute defines the lifetime of the
|
||||||
@ -551,7 +551,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("expires", name)) {
|
else if(strcasecompare("expires", name)) {
|
||||||
strstore(&co->expirestr, whatptr);
|
strstore(&co->expirestr, whatptr);
|
||||||
if(!co->expirestr) {
|
if(!co->expirestr) {
|
||||||
badcookie = TRUE;
|
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
|
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
|
.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;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* It turns out, that sometimes the file format allows the path
|
/* 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 */
|
fields++; /* add a field and fall down to secure */
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 3:
|
case 3:
|
||||||
co->secure = Curl_raw_equal(ptr, "TRUE")?TRUE:FALSE;
|
co->secure = strcasecompare(ptr, "TRUE")?TRUE:FALSE;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
co->expires = curlx_strtoofft(ptr, NULL, 10);
|
co->expires = curlx_strtoofft(ptr, NULL, 10);
|
||||||
@ -812,11 +812,11 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
clist = c->cookies;
|
clist = c->cookies;
|
||||||
replace_old = FALSE;
|
replace_old = FALSE;
|
||||||
while(clist) {
|
while(clist) {
|
||||||
if(Curl_raw_equal(clist->name, co->name)) {
|
if(strcasecompare(clist->name, co->name)) {
|
||||||
/* the names are identical */
|
/* the names are identical */
|
||||||
|
|
||||||
if(clist->domain && co->domain) {
|
if(clist->domain && co->domain) {
|
||||||
if(Curl_raw_equal(clist->domain, co->domain) &&
|
if(strcasecompare(clist->domain, co->domain) &&
|
||||||
(clist->tailmatch == co->tailmatch))
|
(clist->tailmatch == co->tailmatch))
|
||||||
/* The domains are identical */
|
/* The domains are identical */
|
||||||
replace_old=TRUE;
|
replace_old=TRUE;
|
||||||
@ -828,7 +828,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||||||
/* the domains were identical */
|
/* the domains were identical */
|
||||||
|
|
||||||
if(clist->spath && co->spath) {
|
if(clist->spath && co->spath) {
|
||||||
if(Curl_raw_equal(clist->spath, co->spath)) {
|
if(strcasecompare(clist->spath, co->spath)) {
|
||||||
replace_old = TRUE;
|
replace_old = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1101,7 +1101,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
|||||||
/* now check if the domain is correct */
|
/* now check if the domain is correct */
|
||||||
if(!co->domain ||
|
if(!co->domain ||
|
||||||
(co->tailmatch && !is_ip && tailmatch(co->domain, host)) ||
|
(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
|
/* the right part of the host matches the domain stuff in the
|
||||||
cookie data */
|
cookie data */
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include "non-ascii.h"
|
#include "non-ascii.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "curl_ntlm_core.h"
|
#include "curl_ntlm_core.h"
|
||||||
#include "curl_md5.h"
|
#include "curl_md5.h"
|
||||||
#include "curl_hmac.h"
|
#include "curl_hmac.h"
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
#include "curl_sasl.h"
|
#include "curl_sasl.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "strtok.h"
|
#include "strtok.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
|
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
|
@ -67,15 +67,14 @@
|
|||||||
be removed from a future libcurl official API:
|
be removed from a future libcurl official API:
|
||||||
curlx_getenv
|
curlx_getenv
|
||||||
curlx_mprintf (and its variations)
|
curlx_mprintf (and its variations)
|
||||||
curlx_strequal
|
curlx_strcasecompare
|
||||||
curlx_strnequal
|
curlx_strncasecompare
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define curlx_getenv curl_getenv
|
#define curlx_getenv curl_getenv
|
||||||
#define curlx_strcasecompare curl_strcasecompare
|
#define curlx_strcasecompare curl_strcasecompare
|
||||||
#define curlx_strncasecompare curl_strncasecompare
|
#define curlx_strncasecompare curl_strncasecompare
|
||||||
#define curlx_raw_equal Curl_raw_equal
|
|
||||||
#define curlx_mvsnprintf curl_mvsnprintf
|
#define curlx_mvsnprintf curl_mvsnprintf
|
||||||
#define curlx_msnprintf curl_msnprintf
|
#define curlx_msnprintf curl_msnprintf
|
||||||
#define curlx_maprintf curl_maprintf
|
#define curlx_maprintf curl_maprintf
|
||||||
|
14
lib/dict.c
14
lib/dict.c
@ -55,7 +55,7 @@
|
|||||||
#include "escape.h"
|
#include "escape.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "dict.h"
|
#include "dict.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
@ -144,9 +144,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
|
|||||||
/* AUTH is missing */
|
/* AUTH is missing */
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Curl_raw_nequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
|
if(strncasecompare(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
|
||||||
Curl_raw_nequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
|
strncasecompare(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
|
||||||
Curl_raw_nequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
|
strncasecompare(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
|
||||||
|
|
||||||
word = strchr(path, ':');
|
word = strchr(path, ':');
|
||||||
if(word) {
|
if(word) {
|
||||||
@ -202,9 +202,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
|
|||||||
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
||||||
-1, NULL); /* no upload */
|
-1, NULL); /* no upload */
|
||||||
}
|
}
|
||||||
else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
|
else if(strncasecompare(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
|
||||||
Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
|
strncasecompare(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
|
||||||
Curl_raw_nequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
|
strncasecompare(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
|
||||||
|
|
||||||
word = strchr(path, ':');
|
word = strchr(path, ':');
|
||||||
if(word) {
|
if(word) {
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
|
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "speedcheck.h"
|
#include "speedcheck.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "http_proxy.h"
|
#include "http_proxy.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -45,7 +45,6 @@
|
|||||||
#include "fileinfo.h"
|
#include "fileinfo.h"
|
||||||
#include "llist.h"
|
#include "llist.h"
|
||||||
#include "strtoofft.h"
|
#include "strtoofft.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
#include "ftplistparser.h"
|
#include "ftplistparser.h"
|
||||||
#include "curl_fnmatch.h"
|
#include "curl_fnmatch.h"
|
||||||
|
@ -28,10 +28,8 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "transfer.h"
|
#include "transfer.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
|
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "gopher.h"
|
#include "gopher.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "escape.h"
|
#include "escape.h"
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "hostcheck.h"
|
#include "hostcheck.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "inet_pton.h"
|
#include "inet_pton.h"
|
||||||
|
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
@ -77,7 +77,7 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
|
|
||||||
pattern_wildcard = strchr(pattern, '*');
|
pattern_wildcard = strchr(pattern, '*');
|
||||||
if(pattern_wildcard == NULL)
|
if(pattern_wildcard == NULL)
|
||||||
return Curl_raw_equal(pattern, hostname) ?
|
return strcasecompare(pattern, hostname) ?
|
||||||
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
/* detect IP address as hostname and fail the match if so */
|
/* detect IP address as hostname and fail the match if so */
|
||||||
@ -94,16 +94,16 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
pattern_label_end = strchr(pattern, '.');
|
pattern_label_end = strchr(pattern, '.');
|
||||||
if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||
|
if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||
|
||||||
pattern_wildcard > pattern_label_end ||
|
pattern_wildcard > pattern_label_end ||
|
||||||
Curl_raw_nequal(pattern, "xn--", 4)) {
|
strncasecompare(pattern, "xn--", 4)) {
|
||||||
wildcard_enabled = 0;
|
wildcard_enabled = 0;
|
||||||
}
|
}
|
||||||
if(!wildcard_enabled)
|
if(!wildcard_enabled)
|
||||||
return Curl_raw_equal(pattern, hostname) ?
|
return strcasecompare(pattern, hostname) ?
|
||||||
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
hostname_label_end = strchr(hostname, '.');
|
hostname_label_end = strchr(hostname, '.');
|
||||||
if(hostname_label_end == NULL ||
|
if(hostname_label_end == NULL ||
|
||||||
!Curl_raw_equal(pattern_label_end, hostname_label_end))
|
!strcasecompare(pattern_label_end, hostname_label_end))
|
||||||
return CURL_HOST_NOMATCH;
|
return CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
/* The wildcard must match at least one character, so the left-most
|
/* The wildcard must match at least one character, so the left-most
|
||||||
@ -114,8 +114,8 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
|
|
||||||
prefixlen = pattern_wildcard - pattern;
|
prefixlen = pattern_wildcard - pattern;
|
||||||
suffixlen = pattern_label_end - (pattern_wildcard+1);
|
suffixlen = pattern_label_end - (pattern_wildcard+1);
|
||||||
return Curl_raw_nequal(pattern, hostname, prefixlen) &&
|
return strncasecompare(pattern, hostname, prefixlen) &&
|
||||||
Curl_raw_nequal(pattern_wildcard+1, hostname_label_end - suffixlen,
|
strncasecompare(pattern_wildcard+1, hostname_label_end - suffixlen,
|
||||||
suffixlen) ?
|
suffixlen) ?
|
||||||
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
||||||
}
|
}
|
||||||
|
14
lib/http.c
14
lib/http.c
@ -67,7 +67,7 @@
|
|||||||
#include "parsedate.h" /* for the week day and month names */
|
#include "parsedate.h" /* for the week day and month names */
|
||||||
#include "strtoofft.h"
|
#include "strtoofft.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "content_encoding.h"
|
#include "content_encoding.h"
|
||||||
#include "http_proxy.h"
|
#include "http_proxy.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
@ -181,7 +181,7 @@ char *Curl_checkheaders(const struct connectdata *conn,
|
|||||||
struct Curl_easy *data = conn->data;
|
struct Curl_easy *data = conn->data;
|
||||||
|
|
||||||
for(head = data->set.headers;head; head=head->next) {
|
for(head = data->set.headers;head; head=head->next) {
|
||||||
if(Curl_raw_nequal(head->data, thisheader, thislen))
|
if(strncasecompare(head->data, thisheader, thislen))
|
||||||
return head->data;
|
return head->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ char *Curl_checkProxyheaders(const struct connectdata *conn,
|
|||||||
for(head = (conn->bits.proxy && data->set.sep_headers) ?
|
for(head = (conn->bits.proxy && data->set.sep_headers) ?
|
||||||
data->set.proxyheaders : data->set.headers;
|
data->set.proxyheaders : data->set.headers;
|
||||||
head; head=head->next) {
|
head; head=head->next) {
|
||||||
if(Curl_raw_nequal(head->data, thisheader, thislen))
|
if(strncasecompare(head->data, thisheader, thislen))
|
||||||
return head->data;
|
return head->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
|||||||
conn->bits.netrc ||
|
conn->bits.netrc ||
|
||||||
!data->state.first_host ||
|
!data->state.first_host ||
|
||||||
data->set.http_disable_hostname_check_before_authentication ||
|
data->set.http_disable_hostname_check_before_authentication ||
|
||||||
Curl_raw_equal(data->state.first_host, conn->host.name)) {
|
strcasecompare(data->state.first_host, conn->host.name)) {
|
||||||
result = output_auth_headers(conn, authhost, request, path, FALSE);
|
result = output_auth_headers(conn, authhost, request, path, FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1304,7 +1304,7 @@ Curl_compareheader(const char *headerline, /* line to check */
|
|||||||
const char *start;
|
const char *start;
|
||||||
const char *end;
|
const char *end;
|
||||||
|
|
||||||
if(!Curl_raw_nequal(headerline, header, hlen))
|
if(!strncasecompare(headerline, header, hlen))
|
||||||
return FALSE; /* doesn't start with header */
|
return FALSE; /* doesn't start with header */
|
||||||
|
|
||||||
/* pass the header */
|
/* pass the header */
|
||||||
@ -1330,7 +1330,7 @@ Curl_compareheader(const char *headerline, /* line to check */
|
|||||||
|
|
||||||
/* find the content string in the rest of the line */
|
/* find the content string in the rest of the line */
|
||||||
for(;len>=clen;len--, start++) {
|
for(;len>=clen;len--, start++) {
|
||||||
if(Curl_raw_nequal(start, content, clen))
|
if(strncasecompare(start, content, clen))
|
||||||
return TRUE; /* match! */
|
return TRUE; /* match! */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1972,7 +1972,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
ptr = Curl_checkheaders(conn, "Host:");
|
ptr = Curl_checkheaders(conn, "Host:");
|
||||||
if(ptr && (!data->state.this_is_a_follow ||
|
if(ptr && (!data->state.this_is_a_follow ||
|
||||||
Curl_raw_equal(data->state.first_host, conn->host.name))) {
|
strcasecompare(data->state.first_host, conn->host.name))) {
|
||||||
#if !defined(CURL_DISABLE_COOKIES)
|
#if !defined(CURL_DISABLE_COOKIES)
|
||||||
/* If we have a given custom Host: header, we extract the host name in
|
/* If we have a given custom Host: header, we extract the host name in
|
||||||
order to possibly use it for cookie reasons later on. We only allow the
|
order to possibly use it for cookie reasons later on. We only allow the
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "http.h"
|
#include "http.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "curl_base64.h"
|
#include "curl_base64.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "conncache.h"
|
#include "conncache.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
@ -319,7 +319,7 @@ char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header)
|
|||||||
the middle of header, it could be matched in middle of the value,
|
the middle of header, it could be matched in middle of the value,
|
||||||
this is because we do prefix match.*/
|
this is because we do prefix match.*/
|
||||||
if(!h || !GOOD_EASY_HANDLE(h->data) || !header || !header[0] ||
|
if(!h || !GOOD_EASY_HANDLE(h->data) || !header || !header[0] ||
|
||||||
Curl_raw_equal(header, ":") || strchr(header + 1, ':'))
|
!strcmp(header, ":") || strchr(header + 1, ':'))
|
||||||
return NULL;
|
return NULL;
|
||||||
else {
|
else {
|
||||||
struct HTTP *stream = h->data->req.protop;
|
struct HTTP *stream = h->data->req.protop;
|
||||||
@ -1743,12 +1743,12 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
|
|||||||
goto fail;
|
goto fail;
|
||||||
hlen = end - hdbuf;
|
hlen = end - hdbuf;
|
||||||
|
|
||||||
if(hlen == 10 && Curl_raw_nequal("connection", hdbuf, 10)) {
|
if(hlen == 10 && strncasecompare("connection", hdbuf, 10)) {
|
||||||
/* skip Connection: headers! */
|
/* skip Connection: headers! */
|
||||||
skip = 1;
|
skip = 1;
|
||||||
--nheader;
|
--nheader;
|
||||||
}
|
}
|
||||||
else if(hlen == 4 && Curl_raw_nequal("host", hdbuf, 4)) {
|
else if(hlen == 4 && strncasecompare("host", hdbuf, 4)) {
|
||||||
authority_idx = i;
|
authority_idx = i;
|
||||||
nva[i].name = (unsigned char *)":authority";
|
nva[i].name = (unsigned char *)":authority";
|
||||||
nva[i].namelen = strlen((char *)nva[i].name);
|
nva[i].namelen = strlen((char *)nva[i].name);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
|
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
|
||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "vauth/vauth.h"
|
#include "vauth/vauth.h"
|
||||||
#include "http_digest.h"
|
#include "http_digest.h"
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "http_negotiate.h"
|
#include "http_negotiate.h"
|
||||||
#include "vauth/vauth.h"
|
#include "vauth/vauth.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "http_ntlm.h"
|
#include "http_ntlm.h"
|
||||||
#include "curl_ntlm_wb.h"
|
#include "curl_ntlm_wb.h"
|
||||||
#include "vauth/vauth.h"
|
#include "vauth/vauth.h"
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "http.h"
|
#include "http.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "non-ascii.h"
|
#include "non-ascii.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
|
12
lib/imap.c
12
lib/imap.c
@ -76,7 +76,7 @@
|
|||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "curl_sasl.h"
|
#include "curl_sasl.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ static bool imap_matchresp(const char *line, size_t len, const char *cmd)
|
|||||||
|
|
||||||
/* Does the command name match and is it followed by a space character or at
|
/* Does the command name match and is it followed by a space character or at
|
||||||
the end of line? */
|
the end of line? */
|
||||||
if(line + cmd_len <= end && Curl_raw_nequal(line, cmd, cmd_len) &&
|
if(line + cmd_len <= end && strncasecompare(line, cmd, cmd_len) &&
|
||||||
(line[cmd_len] == ' ' || line + cmd_len + 2 == end))
|
(line[cmd_len] == ' ' || line + cmd_len + 2 == end))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -2030,28 +2030,28 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
PARTIAL) stripping of the trailing slash character if it is present.
|
PARTIAL) stripping of the trailing slash character if it is present.
|
||||||
|
|
||||||
Note: Unknown parameters trigger a URL_MALFORMAT error. */
|
Note: Unknown parameters trigger a URL_MALFORMAT error. */
|
||||||
if(Curl_raw_equal(name, "UIDVALIDITY") && !imap->uidvalidity) {
|
if(strcasecompare(name, "UIDVALIDITY") && !imap->uidvalidity) {
|
||||||
if(valuelen > 0 && value[valuelen - 1] == '/')
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
value[valuelen - 1] = '\0';
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
imap->uidvalidity = value;
|
imap->uidvalidity = value;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(name, "UID") && !imap->uid) {
|
else if(strcasecompare(name, "UID") && !imap->uid) {
|
||||||
if(valuelen > 0 && value[valuelen - 1] == '/')
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
value[valuelen - 1] = '\0';
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
imap->uid = value;
|
imap->uid = value;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(name, "SECTION") && !imap->section) {
|
else if(strcasecompare(name, "SECTION") && !imap->section) {
|
||||||
if(valuelen > 0 && value[valuelen - 1] == '/')
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
value[valuelen - 1] = '\0';
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
imap->section = value;
|
imap->section = value;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(name, "PARTIAL") && !imap->partial) {
|
else if(strcasecompare(name, "PARTIAL") && !imap->partial) {
|
||||||
if(valuelen > 0 && value[valuelen - 1] == '/')
|
if(valuelen > 0 && value[valuelen - 1] == '/')
|
||||||
value[valuelen - 1] = '\0';
|
value[valuelen - 1] = '\0';
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
|||||||
/* Novell SDK supports DER or BASE64 files. */
|
/* Novell SDK supports DER or BASE64 files. */
|
||||||
int cert_type = LDAPSSL_CERT_FILETYPE_B64;
|
int cert_type = LDAPSSL_CERT_FILETYPE_B64;
|
||||||
if((data->set.str[STRING_CERT_TYPE]) &&
|
if((data->set.str[STRING_CERT_TYPE]) &&
|
||||||
(Curl_raw_equal(data->set.str[STRING_CERT_TYPE], "DER")))
|
(strcasecompare(data->set.str[STRING_CERT_TYPE], "DER")))
|
||||||
cert_type = LDAPSSL_CERT_FILETYPE_DER;
|
cert_type = LDAPSSL_CERT_FILETYPE_DER;
|
||||||
if(!ldap_ca) {
|
if(!ldap_ca) {
|
||||||
failf(data, "LDAP local: ERROR %s CA cert not set!",
|
failf(data, "LDAP local: ERROR %s CA cert not set!",
|
||||||
@ -325,7 +325,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
|||||||
if(data->set.ssl.verifypeer) {
|
if(data->set.ssl.verifypeer) {
|
||||||
/* OpenLDAP SDK supports BASE64 files. */
|
/* OpenLDAP SDK supports BASE64 files. */
|
||||||
if((data->set.str[STRING_CERT_TYPE]) &&
|
if((data->set.str[STRING_CERT_TYPE]) &&
|
||||||
(!Curl_raw_equal(data->set.str[STRING_CERT_TYPE], "PEM"))) {
|
(!strcasecompare(data->set.str[STRING_CERT_TYPE], "PEM"))) {
|
||||||
failf(data, "LDAP local: ERROR OpenLDAP only supports PEM cert-type!");
|
failf(data, "LDAP local: ERROR OpenLDAP only supports PEM cert-type!");
|
||||||
result = CURLE_SSL_CERTPROBLEM;
|
result = CURLE_SSL_CERTPROBLEM;
|
||||||
goto quit;
|
goto quit;
|
||||||
|
16
lib/netrc.c
16
lib/netrc.c
@ -29,7 +29,7 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "netrc.h"
|
#include "netrc.h"
|
||||||
#include "strtok.h"
|
#include "strtok.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
@ -128,20 +128,20 @@ int Curl_parsenetrc(const char *host,
|
|||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case NOTHING:
|
case NOTHING:
|
||||||
if(Curl_raw_equal("machine", tok)) {
|
if(strcasecompare("machine", tok)) {
|
||||||
/* the next tok is the machine name, this is in itself the
|
/* the next tok is the machine name, this is in itself the
|
||||||
delimiter that starts the stuff entered for this machine,
|
delimiter that starts the stuff entered for this machine,
|
||||||
after this we need to search for 'login' and
|
after this we need to search for 'login' and
|
||||||
'password'. */
|
'password'. */
|
||||||
state=HOSTFOUND;
|
state=HOSTFOUND;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("default", tok)) {
|
else if(strcasecompare("default", tok)) {
|
||||||
state=HOSTVALID;
|
state=HOSTVALID;
|
||||||
retcode=0; /* we did find our host */
|
retcode=0; /* we did find our host */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOSTFOUND:
|
case HOSTFOUND:
|
||||||
if(Curl_raw_equal(host, tok)) {
|
if(strcasecompare(host, tok)) {
|
||||||
/* and yes, this is our host! */
|
/* and yes, this is our host! */
|
||||||
state=HOSTVALID;
|
state=HOSTVALID;
|
||||||
retcode=0; /* we did find our host */
|
retcode=0; /* we did find our host */
|
||||||
@ -154,7 +154,7 @@ int Curl_parsenetrc(const char *host,
|
|||||||
/* we are now parsing sub-keywords concerning "our" host */
|
/* we are now parsing sub-keywords concerning "our" host */
|
||||||
if(state_login) {
|
if(state_login) {
|
||||||
if(specific_login) {
|
if(specific_login) {
|
||||||
state_our_login = Curl_raw_equal(*loginp, tok);
|
state_our_login = strcasecompare(*loginp, tok);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
free(*loginp);
|
free(*loginp);
|
||||||
@ -177,11 +177,11 @@ int Curl_parsenetrc(const char *host,
|
|||||||
}
|
}
|
||||||
state_password=0;
|
state_password=0;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal("login", tok))
|
else if(strcasecompare("login", tok))
|
||||||
state_login=1;
|
state_login=1;
|
||||||
else if(Curl_raw_equal("password", tok))
|
else if(strcasecompare("password", tok))
|
||||||
state_password=1;
|
state_password=1;
|
||||||
else if(Curl_raw_equal("machine", tok)) {
|
else if(strcasecompare("machine", tok)) {
|
||||||
/* ok, there's machine here go => */
|
/* ok, there's machine here go => */
|
||||||
state = HOSTFOUND;
|
state = HOSTFOUND;
|
||||||
state_our_login = FALSE;
|
state_our_login = FALSE;
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "parsedate.h"
|
#include "parsedate.h"
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ static int checkday(const char *check, size_t len)
|
|||||||
else
|
else
|
||||||
what = &Curl_wkday[0];
|
what = &Curl_wkday[0];
|
||||||
for(i=0; i<7; i++) {
|
for(i=0; i<7; i++) {
|
||||||
if(Curl_raw_equal(check, what[0])) {
|
if(strcasecompare(check, what[0])) {
|
||||||
found=TRUE;
|
found=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ static int checkmonth(const char *check)
|
|||||||
|
|
||||||
what = &Curl_month[0];
|
what = &Curl_month[0];
|
||||||
for(i=0; i<12; i++) {
|
for(i=0; i<12; i++) {
|
||||||
if(Curl_raw_equal(check, what[0])) {
|
if(strcasecompare(check, what[0])) {
|
||||||
found=TRUE;
|
found=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ static int checktz(const char *check)
|
|||||||
|
|
||||||
what = tz;
|
what = tz;
|
||||||
for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) {
|
for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) {
|
||||||
if(Curl_raw_equal(check, what->name)) {
|
if(strcasecompare(check, what->name)) {
|
||||||
found=TRUE;
|
found=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
@ -177,7 +177,7 @@ bool Curl_pipeline_site_blacklisted(struct Curl_easy *handle,
|
|||||||
struct site_blacklist_entry *site;
|
struct site_blacklist_entry *site;
|
||||||
|
|
||||||
site = curr->ptr;
|
site = curr->ptr;
|
||||||
if(Curl_raw_equal(site->hostname, conn->host.name) &&
|
if(strcasecompare(site->hostname, conn->host.name) &&
|
||||||
site->port == conn->remote_port) {
|
site->port == conn->remote_port) {
|
||||||
infof(handle, "Site %s:%d is pipeline blacklisted\n",
|
infof(handle, "Site %s:%d is pipeline blacklisted\n",
|
||||||
conn->host.name, conn->remote_port);
|
conn->host.name, conn->remote_port);
|
||||||
@ -269,7 +269,7 @@ bool Curl_pipeline_server_blacklisted(struct Curl_easy *handle,
|
|||||||
char *bl_server_name;
|
char *bl_server_name;
|
||||||
|
|
||||||
bl_server_name = curr->ptr;
|
bl_server_name = curr->ptr;
|
||||||
if(Curl_raw_nequal(bl_server_name, server_name,
|
if(strncasecompare(bl_server_name, server_name,
|
||||||
strlen(bl_server_name))) {
|
strlen(bl_server_name))) {
|
||||||
infof(handle, "Server %s is blacklisted\n", server_name);
|
infof(handle, "Server %s is blacklisted\n", server_name);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -78,7 +78,6 @@
|
|||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "curl_sasl.h"
|
#include "curl_sasl.h"
|
||||||
#include "curl_md5.h"
|
#include "curl_md5.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
|
148
lib/rawstr.c
148
lib/rawstr.c
@ -1,148 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
||||||
*
|
|
||||||
* This software is licensed as described in the file COPYING, which
|
|
||||||
* you should have received as part of this distribution. The terms
|
|
||||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
|
||||||
*
|
|
||||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
||||||
* copies of the Software, and permit persons to whom the Software is
|
|
||||||
* furnished to do so, under the terms of the COPYING file.
|
|
||||||
*
|
|
||||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
||||||
* KIND, either express or implied.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "curl_setup.h"
|
|
||||||
|
|
||||||
#include "rawstr.h"
|
|
||||||
|
|
||||||
/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because
|
|
||||||
its behavior is altered by the current locale. */
|
|
||||||
char Curl_raw_toupper(char in)
|
|
||||||
{
|
|
||||||
#if !defined(CURL_DOES_CONVERSIONS)
|
|
||||||
if(in >= 'a' && in <= 'z')
|
|
||||||
return (char)('A' + in - 'a');
|
|
||||||
#else
|
|
||||||
switch (in) {
|
|
||||||
case 'a':
|
|
||||||
return 'A';
|
|
||||||
case 'b':
|
|
||||||
return 'B';
|
|
||||||
case 'c':
|
|
||||||
return 'C';
|
|
||||||
case 'd':
|
|
||||||
return 'D';
|
|
||||||
case 'e':
|
|
||||||
return 'E';
|
|
||||||
case 'f':
|
|
||||||
return 'F';
|
|
||||||
case 'g':
|
|
||||||
return 'G';
|
|
||||||
case 'h':
|
|
||||||
return 'H';
|
|
||||||
case 'i':
|
|
||||||
return 'I';
|
|
||||||
case 'j':
|
|
||||||
return 'J';
|
|
||||||
case 'k':
|
|
||||||
return 'K';
|
|
||||||
case 'l':
|
|
||||||
return 'L';
|
|
||||||
case 'm':
|
|
||||||
return 'M';
|
|
||||||
case 'n':
|
|
||||||
return 'N';
|
|
||||||
case 'o':
|
|
||||||
return 'O';
|
|
||||||
case 'p':
|
|
||||||
return 'P';
|
|
||||||
case 'q':
|
|
||||||
return 'Q';
|
|
||||||
case 'r':
|
|
||||||
return 'R';
|
|
||||||
case 's':
|
|
||||||
return 'S';
|
|
||||||
case 't':
|
|
||||||
return 'T';
|
|
||||||
case 'u':
|
|
||||||
return 'U';
|
|
||||||
case 'v':
|
|
||||||
return 'V';
|
|
||||||
case 'w':
|
|
||||||
return 'W';
|
|
||||||
case 'x':
|
|
||||||
return 'X';
|
|
||||||
case 'y':
|
|
||||||
return 'Y';
|
|
||||||
case 'z':
|
|
||||||
return 'Z';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant
|
|
||||||
* to be locale independent and only compare strings we know are safe for
|
|
||||||
* this. See https://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for
|
|
||||||
* some further explanation to why this function is necessary.
|
|
||||||
*
|
|
||||||
* The function is capable of comparing a-z case insensitively even for
|
|
||||||
* non-ascii.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int Curl_raw_equal(const char *first, const char *second)
|
|
||||||
{
|
|
||||||
while(*first && *second) {
|
|
||||||
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
|
|
||||||
/* get out of the loop as soon as they don't match */
|
|
||||||
break;
|
|
||||||
first++;
|
|
||||||
second++;
|
|
||||||
}
|
|
||||||
/* we do the comparison here (possibly again), just to make sure that if the
|
|
||||||
loop above is skipped because one of the strings reached zero, we must not
|
|
||||||
return this as a successful match */
|
|
||||||
return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second));
|
|
||||||
}
|
|
||||||
|
|
||||||
int Curl_raw_nequal(const char *first, const char *second, size_t max)
|
|
||||||
{
|
|
||||||
while(*first && *second && max) {
|
|
||||||
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
max--;
|
|
||||||
first++;
|
|
||||||
second++;
|
|
||||||
}
|
|
||||||
if(0 == max)
|
|
||||||
return 1; /* they are equal this far */
|
|
||||||
|
|
||||||
return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy an upper case version of the string from src to dest. The
|
|
||||||
* strings may overlap. No more than n characters of the string are copied
|
|
||||||
* (including any NUL) and the destination string will NOT be
|
|
||||||
* NUL-terminated if that limit is reached.
|
|
||||||
*/
|
|
||||||
void Curl_strntoupper(char *dest, const char *src, size_t n)
|
|
||||||
{
|
|
||||||
if(n < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
do {
|
|
||||||
*dest++ = Curl_raw_toupper(*src);
|
|
||||||
} while(*src++ && --n);
|
|
||||||
}
|
|
47
lib/rawstr.h
47
lib/rawstr.h
@ -1,47 +0,0 @@
|
|||||||
#ifndef HEADER_CURL_RAWSTR_H
|
|
||||||
#define HEADER_CURL_RAWSTR_H
|
|
||||||
/***************************************************************************
|
|
||||||
* _ _ ____ _
|
|
||||||
* Project ___| | | | _ \| |
|
|
||||||
* / __| | | | |_) | |
|
|
||||||
* | (__| |_| | _ <| |___
|
|
||||||
* \___|\___/|_| \_\_____|
|
|
||||||
*
|
|
||||||
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
||||||
*
|
|
||||||
* This software is licensed as described in the file COPYING, which
|
|
||||||
* you should have received as part of this distribution. The terms
|
|
||||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
|
||||||
*
|
|
||||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
||||||
* copies of the Software, and permit persons to whom the Software is
|
|
||||||
* furnished to do so, under the terms of the COPYING file.
|
|
||||||
*
|
|
||||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
||||||
* KIND, either express or implied.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <curl/curl.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant
|
|
||||||
* to be locale independent and only compare strings we know are safe for
|
|
||||||
* this.
|
|
||||||
*
|
|
||||||
* The function is capable of comparing a-z case insensitively even for
|
|
||||||
* non-ascii.
|
|
||||||
*/
|
|
||||||
int Curl_raw_equal(const char *first, const char *second);
|
|
||||||
int Curl_raw_nequal(const char *first, const char *second, size_t max);
|
|
||||||
|
|
||||||
char Curl_raw_toupper(char in);
|
|
||||||
|
|
||||||
/* checkprefix() is a shorter version of the above, used when the first
|
|
||||||
argument is zero-byte terminated */
|
|
||||||
#define checkprefix(a,b) Curl_raw_nequal(a,b,strlen(a))
|
|
||||||
|
|
||||||
void Curl_strntoupper(char *dest, const char *src, size_t n);
|
|
||||||
|
|
||||||
#endif /* HEADER_CURL_RAWSTR_H */
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
|||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "rtsp.h"
|
#include "rtsp.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
#include "curl_sec.h"
|
#include "curl_sec.h"
|
||||||
#include "ftp.h"
|
#include "ftp.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
|
|
||||||
/* The last #include file should be: */
|
/* The last #include file should be: */
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "curl_gethostname.h"
|
#include "curl_gethostname.h"
|
||||||
#include "curl_sasl.h"
|
#include "curl_sasl.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
|
30
lib/ssh.c
30
lib/ssh.c
@ -72,7 +72,7 @@
|
|||||||
#include "speedcheck.h"
|
#include "speedcheck.h"
|
||||||
#include "getinfo.h"
|
#include "getinfo.h"
|
||||||
|
|
||||||
#include "strequal.h"
|
#include "strcase.h"
|
||||||
#include "vtls/vtls.h"
|
#include "vtls/vtls.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
#include "strerror.h"
|
#include "strerror.h"
|
||||||
@ -1297,9 +1297,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
* OpenSSH's sftp program and call the appropriate libssh2
|
* OpenSSH's sftp program and call the appropriate libssh2
|
||||||
* functions.
|
* functions.
|
||||||
*/
|
*/
|
||||||
if(curl_strnequal(cmd, "chgrp ", 6) ||
|
if(strncasecompare(cmd, "chgrp ", 6) ||
|
||||||
curl_strnequal(cmd, "chmod ", 6) ||
|
strncasecompare(cmd, "chmod ", 6) ||
|
||||||
curl_strnequal(cmd, "chown ", 6) ) {
|
strncasecompare(cmd, "chown ", 6) ) {
|
||||||
/* attribute change */
|
/* attribute change */
|
||||||
|
|
||||||
/* sshc->quote_path1 contains the mode to set */
|
/* sshc->quote_path1 contains the mode to set */
|
||||||
@ -1321,8 +1321,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
state(conn, SSH_SFTP_QUOTE_STAT);
|
state(conn, SSH_SFTP_QUOTE_STAT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "ln ", 3) ||
|
else if(strncasecompare(cmd, "ln ", 3) ||
|
||||||
curl_strnequal(cmd, "symlink ", 8)) {
|
strncasecompare(cmd, "symlink ", 8)) {
|
||||||
/* symbolic linking */
|
/* symbolic linking */
|
||||||
/* sshc->quote_path1 is the source */
|
/* sshc->quote_path1 is the source */
|
||||||
/* get the destination */
|
/* get the destination */
|
||||||
@ -1342,12 +1342,12 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
state(conn, SSH_SFTP_QUOTE_SYMLINK);
|
state(conn, SSH_SFTP_QUOTE_SYMLINK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "mkdir ", 6)) {
|
else if(strncasecompare(cmd, "mkdir ", 6)) {
|
||||||
/* create dir */
|
/* create dir */
|
||||||
state(conn, SSH_SFTP_QUOTE_MKDIR);
|
state(conn, SSH_SFTP_QUOTE_MKDIR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "rename ", 7)) {
|
else if(strncasecompare(cmd, "rename ", 7)) {
|
||||||
/* rename file */
|
/* rename file */
|
||||||
/* first param is the source path */
|
/* first param is the source path */
|
||||||
/* second param is the dest. path */
|
/* second param is the dest. path */
|
||||||
@ -1366,17 +1366,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
state(conn, SSH_SFTP_QUOTE_RENAME);
|
state(conn, SSH_SFTP_QUOTE_RENAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "rmdir ", 6)) {
|
else if(strncasecompare(cmd, "rmdir ", 6)) {
|
||||||
/* delete dir */
|
/* delete dir */
|
||||||
state(conn, SSH_SFTP_QUOTE_RMDIR);
|
state(conn, SSH_SFTP_QUOTE_RMDIR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "rm ", 3)) {
|
else if(strncasecompare(cmd, "rm ", 3)) {
|
||||||
state(conn, SSH_SFTP_QUOTE_UNLINK);
|
state(conn, SSH_SFTP_QUOTE_UNLINK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAS_STATVFS_SUPPORT
|
#ifdef HAS_STATVFS_SUPPORT
|
||||||
else if(curl_strnequal(cmd, "statvfs ", 8)) {
|
else if(strncasecompare(cmd, "statvfs ", 8)) {
|
||||||
state(conn, SSH_SFTP_QUOTE_STATVFS);
|
state(conn, SSH_SFTP_QUOTE_STATVFS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1431,7 +1431,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
sshc->acceptfail = TRUE;
|
sshc->acceptfail = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!curl_strnequal(cmd, "chmod", 5)) {
|
if(!strncasecompare(cmd, "chmod", 5)) {
|
||||||
/* Since chown and chgrp only set owner OR group but libssh2 wants to
|
/* Since chown and chgrp only set owner OR group but libssh2 wants to
|
||||||
* set them both at once, we need to obtain the current ownership
|
* set them both at once, we need to obtain the current ownership
|
||||||
* first. This takes an extra protocol round trip.
|
* first. This takes an extra protocol round trip.
|
||||||
@ -1457,7 +1457,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now set the new attributes... */
|
/* Now set the new attributes... */
|
||||||
if(curl_strnequal(cmd, "chgrp", 5)) {
|
if(strncasecompare(cmd, "chgrp", 5)) {
|
||||||
sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10);
|
sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10);
|
||||||
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
|
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
|
||||||
if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
|
if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
|
||||||
@ -1471,7 +1471,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "chmod", 5)) {
|
else if(strncasecompare(cmd, "chmod", 5)) {
|
||||||
sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8);
|
sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8);
|
||||||
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS;
|
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS;
|
||||||
/* permissions are octal */
|
/* permissions are octal */
|
||||||
@ -1486,7 +1486,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(curl_strnequal(cmd, "chown", 5)) {
|
else if(strncasecompare(cmd, "chown", 5)) {
|
||||||
sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10);
|
sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10);
|
||||||
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
|
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID;
|
||||||
if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
|
if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0]) &&
|
||||||
|
125
lib/strcase.c
125
lib/strcase.c
@ -21,34 +21,100 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "curl_setup.h"
|
#include "curl_setup.h"
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "strcase.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
|
/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because
|
||||||
|
its behavior is altered by the current locale. */
|
||||||
|
char Curl_raw_toupper(char in)
|
||||||
|
{
|
||||||
|
#if !defined(CURL_DOES_CONVERSIONS)
|
||||||
|
if(in >= 'a' && in <= 'z')
|
||||||
|
return (char)('A' + in - 'a');
|
||||||
|
#else
|
||||||
|
switch (in) {
|
||||||
|
case 'a':
|
||||||
|
return 'A';
|
||||||
|
case 'b':
|
||||||
|
return 'B';
|
||||||
|
case 'c':
|
||||||
|
return 'C';
|
||||||
|
case 'd':
|
||||||
|
return 'D';
|
||||||
|
case 'e':
|
||||||
|
return 'E';
|
||||||
|
case 'f':
|
||||||
|
return 'F';
|
||||||
|
case 'g':
|
||||||
|
return 'G';
|
||||||
|
case 'h':
|
||||||
|
return 'H';
|
||||||
|
case 'i':
|
||||||
|
return 'I';
|
||||||
|
case 'j':
|
||||||
|
return 'J';
|
||||||
|
case 'k':
|
||||||
|
return 'K';
|
||||||
|
case 'l':
|
||||||
|
return 'L';
|
||||||
|
case 'm':
|
||||||
|
return 'M';
|
||||||
|
case 'n':
|
||||||
|
return 'N';
|
||||||
|
case 'o':
|
||||||
|
return 'O';
|
||||||
|
case 'p':
|
||||||
|
return 'P';
|
||||||
|
case 'q':
|
||||||
|
return 'Q';
|
||||||
|
case 'r':
|
||||||
|
return 'R';
|
||||||
|
case 's':
|
||||||
|
return 'S';
|
||||||
|
case 't':
|
||||||
|
return 'T';
|
||||||
|
case 'u':
|
||||||
|
return 'U';
|
||||||
|
case 'v':
|
||||||
|
return 'V';
|
||||||
|
case 'w':
|
||||||
|
return 'W';
|
||||||
|
case 'x':
|
||||||
|
return 'X';
|
||||||
|
case 'y':
|
||||||
|
return 'Y';
|
||||||
|
case 'z':
|
||||||
|
return 'Z';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant
|
||||||
|
* to be locale independent and only compare strings we know are safe for
|
||||||
|
* this. See https://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for
|
||||||
|
* some further explanation to why this function is necessary.
|
||||||
|
*
|
||||||
|
* The function is capable of comparing a-z case insensitively even for
|
||||||
|
* non-ascii.
|
||||||
|
*
|
||||||
* @unittest: 1301
|
* @unittest: 1301
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int curl_strcasecompare(const char *first, const char *second)
|
int curl_strcasecompare(const char *first, const char *second)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_STRCASECMP)
|
|
||||||
return !(strcasecmp)(first, second);
|
|
||||||
#elif defined(HAVE_STRCMPI)
|
|
||||||
return !(strcmpi)(first, second);
|
|
||||||
#elif defined(HAVE_STRICMP)
|
|
||||||
return !(stricmp)(first, second);
|
|
||||||
#else
|
|
||||||
while(*first && *second) {
|
while(*first && *second) {
|
||||||
if(toupper(*first) != toupper(*second)) {
|
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
|
||||||
|
/* get out of the loop as soon as they don't match */
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
first++;
|
first++;
|
||||||
second++;
|
second++;
|
||||||
}
|
}
|
||||||
return toupper(*first) == toupper(*second);
|
/* we do the comparison here (possibly again), just to make sure that if the
|
||||||
#endif
|
loop above is skipped because one of the strings reached zero, we must not
|
||||||
|
return this as a successful match */
|
||||||
|
return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,15 +122,8 @@ int curl_strcasecompare(const char *first, const char *second)
|
|||||||
*/
|
*/
|
||||||
int curl_strncasecompare(const char *first, const char *second, size_t max)
|
int curl_strncasecompare(const char *first, const char *second, size_t max)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_STRNCASECMP)
|
|
||||||
return !strncasecmp(first, second, max);
|
|
||||||
#elif defined(HAVE_STRNCMPI)
|
|
||||||
return !strncmpi(first, second, max);
|
|
||||||
#elif defined(HAVE_STRNICMP)
|
|
||||||
return !strnicmp(first, second, max);
|
|
||||||
#else
|
|
||||||
while(*first && *second && max) {
|
while(*first && *second && max) {
|
||||||
if(toupper(*first) != toupper(*second)) {
|
if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
max--;
|
max--;
|
||||||
@ -74,6 +133,20 @@ int curl_strncasecompare(const char *first, const char *second, size_t max)
|
|||||||
if(0 == max)
|
if(0 == max)
|
||||||
return 1; /* they are equal this far */
|
return 1; /* they are equal this far */
|
||||||
|
|
||||||
return toupper(*first) == toupper(*second);
|
return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
/* Copy an upper case version of the string from src to dest. The
|
||||||
|
* strings may overlap. No more than n characters of the string are copied
|
||||||
|
* (including any NUL) and the destination string will NOT be
|
||||||
|
* NUL-terminated if that limit is reached.
|
||||||
|
*/
|
||||||
|
void Curl_strntoupper(char *dest, const char *src, size_t n)
|
||||||
|
{
|
||||||
|
if(n < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
do {
|
||||||
|
*dest++ = Curl_raw_toupper(*src);
|
||||||
|
} while(*src++ && --n);
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,27 @@
|
|||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only "raw" case insensitive strings. This is meant to be locale independent
|
||||||
|
* and only compare strings we know are safe for this.
|
||||||
|
*
|
||||||
|
* The function is capable of comparing a-z case insensitively even for
|
||||||
|
* non-ascii.
|
||||||
|
*/
|
||||||
|
|
||||||
#define strcasecompare(a,b) curl_strcasecompare(a,b)
|
#define strcasecompare(a,b) curl_strcasecompare(a,b)
|
||||||
#define strncasecompare(a,b,c) curl_strncasecompare(a,b,c)
|
#define strncasecompare(a,b,c) curl_strncasecompare(a,b,c)
|
||||||
|
|
||||||
int curl_strcasecompare(const char *first, const char *second);
|
int curl_strcasecompare(const char *first, const char *second);
|
||||||
int curl_strncasecompare(const char *first, const char *second, size_t max);
|
int curl_strncasecompare(const char *first, const char *second, size_t max);
|
||||||
|
|
||||||
|
char Curl_raw_toupper(char in);
|
||||||
|
|
||||||
|
/* checkprefix() is a shorter version of the above, used when the first
|
||||||
|
argument is zero-byte terminated */
|
||||||
|
#define checkprefix(a,b) strncasecompare(a,b,strlen(a))
|
||||||
|
|
||||||
|
void Curl_strntoupper(char *dest, const char *src, size_t n);
|
||||||
|
char Curl_raw_toupper(char in);
|
||||||
|
|
||||||
#endif /* HEADER_CURL_STRCASE_H */
|
#endif /* HEADER_CURL_STRCASE_H */
|
||||||
|
12
lib/telnet.c
12
lib/telnet.c
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
#include "arpa_telnet.h"
|
#include "arpa_telnet.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
|
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
@ -845,7 +845,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
|||||||
option_keyword, option_arg) == 2) {
|
option_keyword, option_arg) == 2) {
|
||||||
|
|
||||||
/* Terminal type */
|
/* Terminal type */
|
||||||
if(Curl_raw_equal(option_keyword, "TTYPE")) {
|
if(strcasecompare(option_keyword, "TTYPE")) {
|
||||||
strncpy(tn->subopt_ttype, option_arg, 31);
|
strncpy(tn->subopt_ttype, option_arg, 31);
|
||||||
tn->subopt_ttype[31] = 0; /* String termination */
|
tn->subopt_ttype[31] = 0; /* String termination */
|
||||||
tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
|
tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
|
||||||
@ -853,7 +853,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Display variable */
|
/* Display variable */
|
||||||
if(Curl_raw_equal(option_keyword, "XDISPLOC")) {
|
if(strcasecompare(option_keyword, "XDISPLOC")) {
|
||||||
strncpy(tn->subopt_xdisploc, option_arg, 127);
|
strncpy(tn->subopt_xdisploc, option_arg, 127);
|
||||||
tn->subopt_xdisploc[127] = 0; /* String termination */
|
tn->subopt_xdisploc[127] = 0; /* String termination */
|
||||||
tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
|
tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
|
||||||
@ -861,7 +861,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Environment variable */
|
/* Environment variable */
|
||||||
if(Curl_raw_equal(option_keyword, "NEW_ENV")) {
|
if(strcasecompare(option_keyword, "NEW_ENV")) {
|
||||||
beg = curl_slist_append(tn->telnet_vars, option_arg);
|
beg = curl_slist_append(tn->telnet_vars, option_arg);
|
||||||
if(!beg) {
|
if(!beg) {
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
@ -873,7 +873,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Window Size */
|
/* Window Size */
|
||||||
if(Curl_raw_equal(option_keyword, "WS")) {
|
if(strcasecompare(option_keyword, "WS")) {
|
||||||
if(sscanf(option_arg, "%hu%*[xX]%hu",
|
if(sscanf(option_arg, "%hu%*[xX]%hu",
|
||||||
&tn->subopt_wsx, &tn->subopt_wsy) == 2)
|
&tn->subopt_wsx, &tn->subopt_wsy) == 2)
|
||||||
tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;
|
tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;
|
||||||
@ -886,7 +886,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* To take care or not of the 8th bit in data exchange */
|
/* To take care or not of the 8th bit in data exchange */
|
||||||
if(Curl_raw_equal(option_keyword, "BINARY")) {
|
if(strcasecompare(option_keyword, "BINARY")) {
|
||||||
binary_option=atoi(option_arg);
|
binary_option=atoi(option_arg);
|
||||||
if(binary_option!=1) {
|
if(binary_option!=1) {
|
||||||
tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;
|
tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
|
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
|
||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "speedcheck.h"
|
#include "speedcheck.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "escape.h"
|
#include "escape.h"
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
#include "curl_setup.h"
|
#include "curl_setup.h"
|
||||||
#include "strtoofft.h"
|
#include "strtoofft.h"
|
||||||
#include "rawstr.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
#ifdef HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
29
lib/url.c
29
lib/url.c
@ -91,7 +91,6 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
|
|||||||
#include "multiif.h"
|
#include "multiif.h"
|
||||||
#include "easyif.h"
|
#include "easyif.h"
|
||||||
#include "speedcheck.h"
|
#include "speedcheck.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "non-ascii.h"
|
#include "non-ascii.h"
|
||||||
#include "inet_pton.h"
|
#include "inet_pton.h"
|
||||||
@ -1221,23 +1220,23 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
|
|||||||
if(argptr == NULL)
|
if(argptr == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(Curl_raw_equal(argptr, "ALL")) {
|
if(strcasecompare(argptr, "ALL")) {
|
||||||
/* clear all cookies */
|
/* clear all cookies */
|
||||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||||
Curl_cookie_clearall(data->cookies);
|
Curl_cookie_clearall(data->cookies);
|
||||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(argptr, "SESS")) {
|
else if(strcasecompare(argptr, "SESS")) {
|
||||||
/* clear session cookies */
|
/* clear session cookies */
|
||||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||||
Curl_cookie_clearsess(data->cookies);
|
Curl_cookie_clearsess(data->cookies);
|
||||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(argptr, "FLUSH")) {
|
else if(strcasecompare(argptr, "FLUSH")) {
|
||||||
/* flush cookies to file, takes care of the locking */
|
/* flush cookies to file, takes care of the locking */
|
||||||
Curl_flush_cookies(data, 0);
|
Curl_flush_cookies(data, 0);
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(argptr, "RELOAD")) {
|
else if(strcasecompare(argptr, "RELOAD")) {
|
||||||
/* reload cookies from file */
|
/* reload cookies from file */
|
||||||
Curl_cookie_loadfiles(data);
|
Curl_cookie_loadfiles(data);
|
||||||
break;
|
break;
|
||||||
@ -3351,7 +3350,7 @@ ConnectionExists(struct Curl_easy *data,
|
|||||||
(needle->proxytype != check->proxytype ||
|
(needle->proxytype != check->proxytype ||
|
||||||
needle->bits.httpproxy != check->bits.httpproxy ||
|
needle->bits.httpproxy != check->bits.httpproxy ||
|
||||||
needle->bits.tunnel_proxy != check->bits.tunnel_proxy ||
|
needle->bits.tunnel_proxy != check->bits.tunnel_proxy ||
|
||||||
!Curl_raw_equal(needle->proxy.name, check->proxy.name) ||
|
!strcasecompare(needle->proxy.name, check->proxy.name) ||
|
||||||
needle->port != check->port))
|
needle->port != check->port))
|
||||||
/* don't mix connections that use different proxies */
|
/* don't mix connections that use different proxies */
|
||||||
continue;
|
continue;
|
||||||
@ -3406,14 +3405,14 @@ ConnectionExists(struct Curl_easy *data,
|
|||||||
/* The requested connection does not use a HTTP proxy or it uses SSL or
|
/* The requested connection does not use a HTTP proxy or it uses SSL or
|
||||||
it is a non-SSL protocol tunneled over the same HTTP proxy name and
|
it is a non-SSL protocol tunneled over the same HTTP proxy name and
|
||||||
port number */
|
port number */
|
||||||
if((Curl_raw_equal(needle->handler->scheme, check->handler->scheme) ||
|
if((strcasecompare(needle->handler->scheme, check->handler->scheme) ||
|
||||||
(get_protocol_family(check->handler->protocol) ==
|
(get_protocol_family(check->handler->protocol) ==
|
||||||
needle->handler->protocol && check->tls_upgraded)) &&
|
needle->handler->protocol && check->tls_upgraded)) &&
|
||||||
(!needle->bits.conn_to_host || Curl_raw_equal(
|
(!needle->bits.conn_to_host || strcasecompare(
|
||||||
needle->conn_to_host.name, check->conn_to_host.name)) &&
|
needle->conn_to_host.name, check->conn_to_host.name)) &&
|
||||||
(!needle->bits.conn_to_port ||
|
(!needle->bits.conn_to_port ||
|
||||||
needle->conn_to_port == check->conn_to_port) &&
|
needle->conn_to_port == check->conn_to_port) &&
|
||||||
Curl_raw_equal(needle->host.name, check->host.name) &&
|
strcasecompare(needle->host.name, check->host.name) &&
|
||||||
needle->remote_port == check->remote_port) {
|
needle->remote_port == check->remote_port) {
|
||||||
/* The schemes match or the the protocol family is the same and the
|
/* The schemes match or the the protocol family is the same and the
|
||||||
previous connection was TLS upgraded, and the hostname and host
|
previous connection was TLS upgraded, and the hostname and host
|
||||||
@ -3982,7 +3981,7 @@ static CURLcode findprotocol(struct Curl_easy *data,
|
|||||||
variables based on the URL. Now that the handler may be changed later
|
variables based on the URL. Now that the handler may be changed later
|
||||||
when the protocol specific setup function is called. */
|
when the protocol specific setup function is called. */
|
||||||
for(pp = protocols; (p = *pp) != NULL; pp++) {
|
for(pp = protocols; (p = *pp) != NULL; pp++) {
|
||||||
if(Curl_raw_equal(p->scheme, protostr)) {
|
if(strcasecompare(p->scheme, protostr)) {
|
||||||
/* Protocol found in table. Check if allowed */
|
/* Protocol found in table. Check if allowed */
|
||||||
if(!(data->set.allowed_protocols & p->protocol))
|
if(!(data->set.allowed_protocols & p->protocol))
|
||||||
/* nope, get out */
|
/* nope, get out */
|
||||||
@ -4051,7 +4050,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||||||
************************************************************/
|
************************************************************/
|
||||||
if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]",
|
if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]",
|
||||||
protobuf, path)) &&
|
protobuf, path)) &&
|
||||||
Curl_raw_equal(protobuf, "file")) {
|
strcasecompare(protobuf, "file")) {
|
||||||
if(path[0] == '/' && path[1] == '/') {
|
if(path[0] == '/' && path[1] == '/') {
|
||||||
/* Allow omitted hostname (e.g. file:/<path>). This is not strictly
|
/* Allow omitted hostname (e.g. file:/<path>). This is not strictly
|
||||||
* speaking a valid file: URL by RFC 1738, but treating file:/<path> as
|
* speaking a valid file: URL by RFC 1738, but treating file:/<path> as
|
||||||
@ -4491,7 +4490,7 @@ static bool check_noproxy(const char* name, const char* no_proxy)
|
|||||||
char *endptr;
|
char *endptr;
|
||||||
|
|
||||||
if(no_proxy && no_proxy[0]) {
|
if(no_proxy && no_proxy[0]) {
|
||||||
if(Curl_raw_equal("*", no_proxy)) {
|
if(strcasecompare("*", no_proxy)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4529,7 +4528,7 @@ static bool check_noproxy(const char* name, const char* no_proxy)
|
|||||||
if((tok_end - tok_start) <= namelen) {
|
if((tok_end - tok_start) <= namelen) {
|
||||||
/* Match the last part of the name to the domain we are checking. */
|
/* Match the last part of the name to the domain we are checking. */
|
||||||
const char *checkn = name + namelen - (tok_end - tok_start);
|
const char *checkn = name + namelen - (tok_end - tok_start);
|
||||||
if(Curl_raw_nequal(no_proxy + tok_start, checkn,
|
if(strncasecompare(no_proxy + tok_start, checkn,
|
||||||
tok_end - tok_start)) {
|
tok_end - tok_start)) {
|
||||||
if((tok_end - tok_start) == namelen || *(checkn - 1) == '.') {
|
if((tok_end - tok_start) == namelen || *(checkn - 1) == '.') {
|
||||||
/* We either have an exact match, or the previous character is a .
|
/* We either have an exact match, or the previous character is a .
|
||||||
@ -4608,7 +4607,7 @@ static char *detect_proxy(struct connectdata *conn)
|
|||||||
* This can cause 'internal' http/ftp requests to be
|
* This can cause 'internal' http/ftp requests to be
|
||||||
* arbitrarily redirected by any external attacker.
|
* arbitrarily redirected by any external attacker.
|
||||||
*/
|
*/
|
||||||
if(!prox && !Curl_raw_equal("http_proxy", proxy_env)) {
|
if(!prox && !strcasecompare("http_proxy", proxy_env)) {
|
||||||
/* There was no lowercase variable, try the uppercase version: */
|
/* There was no lowercase variable, try the uppercase version: */
|
||||||
Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
|
Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
|
||||||
prox=curl_getenv(proxy_env);
|
prox=curl_getenv(proxy_env);
|
||||||
@ -5998,7 +5997,7 @@ static CURLcode create_conn(struct Curl_easy *data,
|
|||||||
* Do this after the hostnames have been IDN-fixed .
|
* Do this after the hostnames have been IDN-fixed .
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
if(conn->bits.conn_to_host &&
|
if(conn->bits.conn_to_host &&
|
||||||
Curl_raw_equal(conn->conn_to_host.name, conn->host.name)) {
|
strcasecompare(conn->conn_to_host.name, conn->host.name)) {
|
||||||
conn->bits.conn_to_host = FALSE;
|
conn->bits.conn_to_host = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include "curl_md5.h"
|
#include "curl_md5.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "strtok.h"
|
#include "strtok.h"
|
||||||
#include "rawstr.h"
|
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "vtls/vtls.h"
|
#include "vtls/vtls.h"
|
||||||
#include "warnless.h"
|
#include "warnless.h"
|
||||||
#include "strtok.h"
|
#include "strtok.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
|
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
|
|
||||||
@ -217,11 +217,11 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
|
|||||||
|
|
||||||
token = strtok_r(tmp, ",", &tok_buf);
|
token = strtok_r(tmp, ",", &tok_buf);
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
if(Curl_raw_equal(token, DIGEST_QOP_VALUE_STRING_AUTH))
|
if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH))
|
||||||
*value |= DIGEST_QOP_VALUE_AUTH;
|
*value |= DIGEST_QOP_VALUE_AUTH;
|
||||||
else if(Curl_raw_equal(token, DIGEST_QOP_VALUE_STRING_AUTH_INT))
|
else if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH_INT))
|
||||||
*value |= DIGEST_QOP_VALUE_AUTH_INT;
|
*value |= DIGEST_QOP_VALUE_AUTH_INT;
|
||||||
else if(Curl_raw_equal(token, DIGEST_QOP_VALUE_STRING_AUTH_CONF))
|
else if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH_CONF))
|
||||||
*value |= DIGEST_QOP_VALUE_AUTH_CONF;
|
*value |= DIGEST_QOP_VALUE_AUTH_CONF;
|
||||||
|
|
||||||
token = strtok_r(NULL, ",", &tok_buf);
|
token = strtok_r(NULL, ",", &tok_buf);
|
||||||
@ -538,31 +538,31 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
|||||||
|
|
||||||
/* Extract a value=content pair */
|
/* Extract a value=content pair */
|
||||||
if(Curl_auth_digest_get_pair(chlg, value, content, &chlg)) {
|
if(Curl_auth_digest_get_pair(chlg, value, content, &chlg)) {
|
||||||
if(Curl_raw_equal(value, "nonce")) {
|
if(strcasecompare(value, "nonce")) {
|
||||||
free(digest->nonce);
|
free(digest->nonce);
|
||||||
digest->nonce = strdup(content);
|
digest->nonce = strdup(content);
|
||||||
if(!digest->nonce)
|
if(!digest->nonce)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(value, "stale")) {
|
else if(strcasecompare(value, "stale")) {
|
||||||
if(Curl_raw_equal(content, "true")) {
|
if(strcasecompare(content, "true")) {
|
||||||
digest->stale = TRUE;
|
digest->stale = TRUE;
|
||||||
digest->nc = 1; /* we make a new nonce now */
|
digest->nc = 1; /* we make a new nonce now */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(value, "realm")) {
|
else if(strcasecompare(value, "realm")) {
|
||||||
free(digest->realm);
|
free(digest->realm);
|
||||||
digest->realm = strdup(content);
|
digest->realm = strdup(content);
|
||||||
if(!digest->realm)
|
if(!digest->realm)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(value, "opaque")) {
|
else if(strcasecompare(value, "opaque")) {
|
||||||
free(digest->opaque);
|
free(digest->opaque);
|
||||||
digest->opaque = strdup(content);
|
digest->opaque = strdup(content);
|
||||||
if(!digest->opaque)
|
if(!digest->opaque)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(value, "qop")) {
|
else if(strcasecompare(value, "qop")) {
|
||||||
char *tok_buf;
|
char *tok_buf;
|
||||||
/* Tokenize the list and choose auth if possible, use a temporary
|
/* Tokenize the list and choose auth if possible, use a temporary
|
||||||
clone of the buffer since strtok_r() ruins it */
|
clone of the buffer since strtok_r() ruins it */
|
||||||
@ -572,10 +572,10 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
|||||||
|
|
||||||
token = strtok_r(tmp, ",", &tok_buf);
|
token = strtok_r(tmp, ",", &tok_buf);
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
if(Curl_raw_equal(token, DIGEST_QOP_VALUE_STRING_AUTH)) {
|
if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH)) {
|
||||||
foundAuth = TRUE;
|
foundAuth = TRUE;
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(token, DIGEST_QOP_VALUE_STRING_AUTH_INT)) {
|
else if(strcasecompare(token, DIGEST_QOP_VALUE_STRING_AUTH_INT)) {
|
||||||
foundAuthInt = TRUE;
|
foundAuthInt = TRUE;
|
||||||
}
|
}
|
||||||
token = strtok_r(NULL, ",", &tok_buf);
|
token = strtok_r(NULL, ",", &tok_buf);
|
||||||
@ -597,15 +597,15 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
|||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Curl_raw_equal(value, "algorithm")) {
|
else if(strcasecompare(value, "algorithm")) {
|
||||||
free(digest->algorithm);
|
free(digest->algorithm);
|
||||||
digest->algorithm = strdup(content);
|
digest->algorithm = strdup(content);
|
||||||
if(!digest->algorithm)
|
if(!digest->algorithm)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
if(Curl_raw_equal(content, "MD5-sess"))
|
if(strcasecompare(content, "MD5-sess"))
|
||||||
digest->algo = CURLDIGESTALGO_MD5SESS;
|
digest->algo = CURLDIGESTALGO_MD5SESS;
|
||||||
else if(Curl_raw_equal(content, "MD5"))
|
else if(strcasecompare(content, "MD5"))
|
||||||
digest->algo = CURLDIGESTALGO_MD5;
|
digest->algo = CURLDIGESTALGO_MD5;
|
||||||
else
|
else
|
||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
@ -744,7 +744,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
|||||||
|
|
||||||
md5this = (unsigned char *) aprintf("%s:%s", request, uripath);
|
md5this = (unsigned char *) aprintf("%s:%s", request, uripath);
|
||||||
|
|
||||||
if(digest->qop && Curl_raw_equal(digest->qop, "auth-int")) {
|
if(digest->qop && strcasecompare(digest->qop, "auth-int")) {
|
||||||
/* We don't support auth-int for PUT or POST at the moment.
|
/* We don't support auth-int for PUT or POST at the moment.
|
||||||
TODO: replace md5 of empty string with entity-body for PUT/POST */
|
TODO: replace md5 of empty string with entity-body for PUT/POST */
|
||||||
unsigned char *md5this2 = (unsigned char *)
|
unsigned char *md5this2 = (unsigned char *)
|
||||||
@ -820,7 +820,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
|||||||
digest->qop,
|
digest->qop,
|
||||||
request_digest);
|
request_digest);
|
||||||
|
|
||||||
if(Curl_raw_equal(digest->qop, "auth"))
|
if(strcasecompare(digest->qop, "auth"))
|
||||||
digest->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0
|
digest->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0
|
||||||
padded which tells to the server how many times you are
|
padded which tells to the server how many times you are
|
||||||
using the same nonce in the qop=auth mode */
|
using the same nonce in the qop=auth mode */
|
||||||
|
@ -277,7 +277,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg,
|
|||||||
|
|
||||||
/* Extract a value=content pair */
|
/* Extract a value=content pair */
|
||||||
if(Curl_auth_digest_get_pair(chlg, value, content, &chlg)) {
|
if(Curl_auth_digest_get_pair(chlg, value, content, &chlg)) {
|
||||||
if(Curl_raw_equal(value, "realm")) {
|
if(strcasecompare(value, "realm")) {
|
||||||
|
|
||||||
/* Setup identity's domain and length */
|
/* Setup identity's domain and length */
|
||||||
domain.tchar_ptr = Curl_convert_UTF8_to_tchar((char *) content);
|
domain.tchar_ptr = Curl_convert_UTF8_to_tchar((char *) content);
|
||||||
|
@ -118,9 +118,9 @@ static int do_file_type(const char *type)
|
|||||||
{
|
{
|
||||||
if(!type || !type[0])
|
if(!type || !type[0])
|
||||||
return SSL_FILETYPE_PEM;
|
return SSL_FILETYPE_PEM;
|
||||||
if(Curl_raw_equal(type, "PEM"))
|
if(strcasecompare(type, "PEM"))
|
||||||
return SSL_FILETYPE_PEM;
|
return SSL_FILETYPE_PEM;
|
||||||
if(Curl_raw_equal(type, "DER"))
|
if(strcasecompare(type, "DER"))
|
||||||
return SSL_FILETYPE_ASN1;
|
return SSL_FILETYPE_ASN1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -356,9 +356,9 @@ static gnutls_x509_crt_fmt_t do_file_type(const char *type)
|
|||||||
{
|
{
|
||||||
if(!type || !type[0])
|
if(!type || !type[0])
|
||||||
return GNUTLS_X509_FMT_PEM;
|
return GNUTLS_X509_FMT_PEM;
|
||||||
if(Curl_raw_equal(type, "PEM"))
|
if(strcasecompare(type, "PEM"))
|
||||||
return GNUTLS_X509_FMT_PEM;
|
return GNUTLS_X509_FMT_PEM;
|
||||||
if(Curl_raw_equal(type, "DER"))
|
if(strcasecompare(type, "DER"))
|
||||||
return GNUTLS_X509_FMT_DER;
|
return GNUTLS_X509_FMT_DER;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ static SECStatus set_ciphers(struct Curl_easy *data, PRFileDesc * model,
|
|||||||
found = PR_FALSE;
|
found = PR_FALSE;
|
||||||
|
|
||||||
for(i=0; i<NUM_OF_CIPHERS; i++) {
|
for(i=0; i<NUM_OF_CIPHERS; i++) {
|
||||||
if(Curl_raw_equal(cipher, cipherlist[i].name)) {
|
if(strcasecompare(cipher, cipherlist[i].name)) {
|
||||||
cipher_state[i] = PR_TRUE;
|
cipher_state[i] = PR_TRUE;
|
||||||
found = PR_TRUE;
|
found = PR_TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#include "slist.h"
|
#include "slist.h"
|
||||||
#include "select.h"
|
#include "select.h"
|
||||||
#include "vtls.h"
|
#include "vtls.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "hostcheck.h"
|
#include "hostcheck.h"
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
|
|
||||||
@ -289,13 +289,13 @@ static int do_file_type(const char *type)
|
|||||||
{
|
{
|
||||||
if(!type || !type[0])
|
if(!type || !type[0])
|
||||||
return SSL_FILETYPE_PEM;
|
return SSL_FILETYPE_PEM;
|
||||||
if(Curl_raw_equal(type, "PEM"))
|
if(strcasecompare(type, "PEM"))
|
||||||
return SSL_FILETYPE_PEM;
|
return SSL_FILETYPE_PEM;
|
||||||
if(Curl_raw_equal(type, "DER"))
|
if(strcasecompare(type, "DER"))
|
||||||
return SSL_FILETYPE_ASN1;
|
return SSL_FILETYPE_ASN1;
|
||||||
if(Curl_raw_equal(type, "ENG"))
|
if(strcasecompare(type, "ENG"))
|
||||||
return SSL_FILETYPE_ENGINE;
|
return SSL_FILETYPE_ENGINE;
|
||||||
if(Curl_raw_equal(type, "P12"))
|
if(strcasecompare(type, "P12"))
|
||||||
return SSL_FILETYPE_PKCS12;
|
return SSL_FILETYPE_PKCS12;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#include "vtls.h" /* generic SSL protos etc */
|
#include "vtls.h" /* generic SSL protos etc */
|
||||||
#include "slist.h"
|
#include "slist.h"
|
||||||
#include "sendf.h"
|
#include "sendf.h"
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
#include "share.h"
|
#include "share.h"
|
||||||
@ -84,7 +84,7 @@ static bool safe_strequal(char* str1, char* str2)
|
|||||||
{
|
{
|
||||||
if(str1 && str2)
|
if(str1 && str2)
|
||||||
/* both pointers point to something then compare them */
|
/* both pointers point to something then compare them */
|
||||||
return (0 != Curl_raw_equal(str1, str2)) ? TRUE : FALSE;
|
return (0 != strcasecompare(str1, str2)) ? TRUE : FALSE;
|
||||||
else
|
else
|
||||||
/* if both pointers are NULL then treat them as equal */
|
/* if both pointers are NULL then treat them as equal */
|
||||||
return (!str1 && !str2) ? TRUE : FALSE;
|
return (!str1 && !str2) ? TRUE : FALSE;
|
||||||
@ -390,15 +390,15 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
|
|||||||
if(!check->sessionid)
|
if(!check->sessionid)
|
||||||
/* not session ID means blank entry */
|
/* not session ID means blank entry */
|
||||||
continue;
|
continue;
|
||||||
if(Curl_raw_equal(conn->host.name, check->name) &&
|
if(strcasecompare(conn->host.name, check->name) &&
|
||||||
((!conn->bits.conn_to_host && !check->conn_to_host) ||
|
((!conn->bits.conn_to_host && !check->conn_to_host) ||
|
||||||
(conn->bits.conn_to_host && check->conn_to_host &&
|
(conn->bits.conn_to_host && check->conn_to_host &&
|
||||||
Curl_raw_equal(conn->conn_to_host.name, check->conn_to_host))) &&
|
strcasecompare(conn->conn_to_host.name, check->conn_to_host))) &&
|
||||||
((!conn->bits.conn_to_port && check->conn_to_port == -1) ||
|
((!conn->bits.conn_to_port && check->conn_to_port == -1) ||
|
||||||
(conn->bits.conn_to_port && check->conn_to_port != -1 &&
|
(conn->bits.conn_to_port && check->conn_to_port != -1 &&
|
||||||
conn->conn_to_port == check->conn_to_port)) &&
|
conn->conn_to_port == check->conn_to_port)) &&
|
||||||
(conn->remote_port == check->remote_port) &&
|
(conn->remote_port == check->remote_port) &&
|
||||||
Curl_raw_equal(conn->handler->scheme, check->scheme) &&
|
strcasecompare(conn->handler->scheme, check->scheme) &&
|
||||||
Curl_ssl_config_matches(&conn->ssl_config, &check->ssl_config)) {
|
Curl_ssl_config_matches(&conn->ssl_config, &check->ssl_config)) {
|
||||||
/* yes, we have a session ID! */
|
/* yes, we have a session ID! */
|
||||||
(*general_age)++; /* increase general age */
|
(*general_age)++; /* increase general age */
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
# the official API, but we re-use the code here to avoid duplication.
|
# the official API, but we re-use the code here to avoid duplication.
|
||||||
CURLX_CFILES = \
|
CURLX_CFILES = \
|
||||||
../lib/strtoofft.c \
|
../lib/strtoofft.c \
|
||||||
../lib/rawstr.c \
|
../lib/strcase.c \
|
||||||
../lib/nonblock.c \
|
../lib/nonblock.c \
|
||||||
../lib/warnless.c
|
../lib/warnless.c
|
||||||
|
|
||||||
CURLX_HFILES = \
|
CURLX_HFILES = \
|
||||||
../lib/curl_setup.h \
|
../lib/curl_setup.h \
|
||||||
../lib/strtoofft.h \
|
../lib/strtoofft.h \
|
||||||
../lib/rawstr.h \
|
../lib/strcase.h \
|
||||||
../lib/nonblock.h \
|
../lib/nonblock.h \
|
||||||
../lib/warnless.h
|
../lib/warnless.h
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
@ -419,7 +419,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(curlx_strncasecompare(aliases[j].lname, word, fnam)) {
|
if(curlx_strncasecompare(aliases[j].lname, word, fnam)) {
|
||||||
longopt = TRUE;
|
longopt = TRUE;
|
||||||
numhits++;
|
numhits++;
|
||||||
if(curlx_raw_equal(aliases[j].lname, word)) {
|
if(curlx_strcasecompare(aliases[j].lname, word)) {
|
||||||
parse = aliases[j].letter;
|
parse = aliases[j].letter;
|
||||||
hit = j;
|
hit = j;
|
||||||
numhits = 1; /* a single unique hit */
|
numhits = 1; /* a single unique hit */
|
||||||
@ -1343,7 +1343,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
break;
|
break;
|
||||||
case 'f': /* crypto engine */
|
case 'f': /* crypto engine */
|
||||||
GetStr(&config->engine, nextarg);
|
GetStr(&config->engine, nextarg);
|
||||||
if(config->engine && curlx_raw_equal(config->engine, "list"))
|
if(config->engine && curlx_strcasecompare(config->engine, "list"))
|
||||||
return PARAM_ENGINES_REQUESTED;
|
return PARAM_ENGINES_REQUESTED;
|
||||||
break;
|
break;
|
||||||
case 'g': /* CA info PEM file */
|
case 'g': /* CA info PEM file */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
@ -89,7 +89,7 @@ CURLcode get_libcurl_info(void)
|
|||||||
if(curlinfo->protocols) {
|
if(curlinfo->protocols) {
|
||||||
for(proto = curlinfo->protocols; *proto; proto++) {
|
for(proto = curlinfo->protocols; *proto; proto++) {
|
||||||
for(p = possibly_built_in; p->proto_name; p++) {
|
for(p = possibly_built_in; p->proto_name; p++) {
|
||||||
if(curlx_raw_equal(*proto, p->proto_name)) {
|
if(curlx_strcasecompare(*proto, p->proto_name)) {
|
||||||
built_in_protos |= p->proto_pattern;
|
built_in_protos |= p->proto_pattern;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -92,7 +92,7 @@ struct win32_crypto_hash {
|
|||||||
# error "Can't compile METALINK support without a crypto library."
|
# error "Can't compile METALINK support without a crypto library."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
@ -747,7 +747,7 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
|
|||||||
++digest_alias) {
|
++digest_alias) {
|
||||||
metalink_checksum_t **p;
|
metalink_checksum_t **p;
|
||||||
for(p = fileinfo->checksums; *p; ++p) {
|
for(p = fileinfo->checksums; *p; ++p) {
|
||||||
if(Curl_raw_equal(digest_alias->alias_name, (*p)->type) &&
|
if(strcasecompare(digest_alias->alias_name, (*p)->type) &&
|
||||||
check_hex_digest((*p)->hash, digest_alias->digest_def)) {
|
check_hex_digest((*p)->hash, digest_alias->digest_def)) {
|
||||||
f->checksum =
|
f->checksum =
|
||||||
new_metalink_checksum_from_hex_digest(digest_alias->digest_def,
|
new_metalink_checksum_from_hex_digest(digest_alias->digest_def,
|
||||||
@ -777,10 +777,10 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
|
|||||||
metainfo file URL may be appeared in fileinfo->metaurls.
|
metainfo file URL may be appeared in fileinfo->metaurls.
|
||||||
*/
|
*/
|
||||||
if((*p)->type == NULL ||
|
if((*p)->type == NULL ||
|
||||||
Curl_raw_equal((*p)->type, "http") ||
|
strcasecompare((*p)->type, "http") ||
|
||||||
Curl_raw_equal((*p)->type, "https") ||
|
strcasecompare((*p)->type, "https") ||
|
||||||
Curl_raw_equal((*p)->type, "ftp") ||
|
strcasecompare((*p)->type, "ftp") ||
|
||||||
Curl_raw_equal((*p)->type, "ftps")) {
|
strcasecompare((*p)->type, "ftps")) {
|
||||||
res = new_metalink_resource((*p)->url);
|
res = new_metalink_resource((*p)->url);
|
||||||
tail->next = res;
|
tail->next = res;
|
||||||
tail = res;
|
tail = res;
|
||||||
@ -906,7 +906,7 @@ static int check_content_type(const char *content_type, const char *media_type)
|
|||||||
if(!*ptr) {
|
if(!*ptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Curl_raw_nequal(ptr, media_type, media_type_len) &&
|
return strncasecompare(ptr, media_type, media_type_len) &&
|
||||||
(*(ptr+media_type_len) == '\0' || *(ptr+media_type_len) == ' ' ||
|
(*(ptr+media_type_len) == '\0' || *(ptr+media_type_len) == ' ' ||
|
||||||
*(ptr+media_type_len) == '\t' || *(ptr+media_type_len) == ';');
|
*(ptr+media_type_len) == '\t' || *(ptr+media_type_len) == ';');
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
# include <fabdef.h>
|
# include <fabdef.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#include "tool_setup.h"
|
#include "tool_setup.h"
|
||||||
|
|
||||||
#include "rawstr.h"
|
#include "strcase.h"
|
||||||
|
|
||||||
#define ENABLE_CURLX_PRINTF
|
#define ENABLE_CURLX_PRINTF
|
||||||
/* use our own printf() functions */
|
/* use our own printf() functions */
|
||||||
@ -312,7 +312,7 @@ long proto2num(struct OperationConfig *config, long *val, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(pp=protos; pp->name; pp++) {
|
for(pp=protos; pp->name; pp++) {
|
||||||
if(curlx_raw_equal(token, pp->name)) {
|
if(curlx_strcasecompare(token, pp->name)) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case deny:
|
case deny:
|
||||||
*val &= ~(pp->bit);
|
*val &= ~(pp->bit);
|
||||||
@ -355,7 +355,7 @@ int check_protocol(const char *str)
|
|||||||
if(!str)
|
if(!str)
|
||||||
return PARAM_REQUIRES_PARAMETER;
|
return PARAM_REQUIRES_PARAMETER;
|
||||||
for(pp = curlinfo->protocols; *pp; pp++) {
|
for(pp = curlinfo->protocols; *pp; pp++) {
|
||||||
if(curlx_raw_equal(*pp, str))
|
if(curlx_strcasecompare(*pp, str))
|
||||||
return PARAM_OK;
|
return PARAM_OK;
|
||||||
}
|
}
|
||||||
return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL;
|
return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL;
|
||||||
@ -466,11 +466,11 @@ ParameterError add2list(struct curl_slist **list, const char *ptr)
|
|||||||
|
|
||||||
int ftpfilemethod(struct OperationConfig *config, const char *str)
|
int ftpfilemethod(struct OperationConfig *config, const char *str)
|
||||||
{
|
{
|
||||||
if(curlx_raw_equal("singlecwd", str))
|
if(curlx_strcasecompare("singlecwd", str))
|
||||||
return CURLFTPMETHOD_SINGLECWD;
|
return CURLFTPMETHOD_SINGLECWD;
|
||||||
if(curlx_raw_equal("nocwd", str))
|
if(curlx_strcasecompare("nocwd", str))
|
||||||
return CURLFTPMETHOD_NOCWD;
|
return CURLFTPMETHOD_NOCWD;
|
||||||
if(curlx_raw_equal("multicwd", str))
|
if(curlx_strcasecompare("multicwd", str))
|
||||||
return CURLFTPMETHOD_MULTICWD;
|
return CURLFTPMETHOD_MULTICWD;
|
||||||
|
|
||||||
warnf(config->global, "unrecognized ftp file method '%s', using default\n",
|
warnf(config->global, "unrecognized ftp file method '%s', using default\n",
|
||||||
@ -481,9 +481,9 @@ int ftpfilemethod(struct OperationConfig *config, const char *str)
|
|||||||
|
|
||||||
int ftpcccmethod(struct OperationConfig *config, const char *str)
|
int ftpcccmethod(struct OperationConfig *config, const char *str)
|
||||||
{
|
{
|
||||||
if(curlx_raw_equal("passive", str))
|
if(curlx_strcasecompare("passive", str))
|
||||||
return CURLFTPSSL_CCC_PASSIVE;
|
return CURLFTPSSL_CCC_PASSIVE;
|
||||||
if(curlx_raw_equal("active", str))
|
if(curlx_strcasecompare("active", str))
|
||||||
return CURLFTPSSL_CCC_ACTIVE;
|
return CURLFTPSSL_CCC_ACTIVE;
|
||||||
|
|
||||||
warnf(config->global, "unrecognized ftp CCC method '%s', using default\n",
|
warnf(config->global, "unrecognized ftp CCC method '%s', using default\n",
|
||||||
@ -494,11 +494,11 @@ int ftpcccmethod(struct OperationConfig *config, const char *str)
|
|||||||
|
|
||||||
long delegation(struct OperationConfig *config, char *str)
|
long delegation(struct OperationConfig *config, char *str)
|
||||||
{
|
{
|
||||||
if(curlx_raw_equal("none", str))
|
if(curlx_strcasecompare("none", str))
|
||||||
return CURLGSSAPI_DELEGATION_NONE;
|
return CURLGSSAPI_DELEGATION_NONE;
|
||||||
if(curlx_raw_equal("policy", str))
|
if(curlx_strcasecompare("policy", str))
|
||||||
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
|
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
|
||||||
if(curlx_raw_equal("always", str))
|
if(curlx_strcasecompare("always", str))
|
||||||
return CURLGSSAPI_DELEGATION_FLAG;
|
return CURLGSSAPI_DELEGATION_FLAG;
|
||||||
|
|
||||||
warnf(config->global, "unrecognized delegation method '%s', using none\n",
|
warnf(config->global, "unrecognized delegation method '%s', using none\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user