From cd731b77d7e6d0398010ff45bb80e9a3534eaccc Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 10 Feb 2009 21:40:12 +0000 Subject: Do not use ctypes functions in cases when we need the "net" locale. This patch adds a new set of EVUTIL_IS* functions to replace use of the ctypes is* functions in all cases where we care about characters' interpretations in net ascii rather than in the locale. For example, when we're working with DNS hostnames, we don't want to do the 0x20 hack on non-ascii characters, even if the host thinks they should be isalpha. svn:r1114 --- http.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'http.c') diff --git a/http.c b/http.c index 5349c717..18984368 100644 --- a/http.c +++ b/http.c @@ -63,7 +63,6 @@ #endif #include -#include #include #include #include @@ -2125,8 +2124,8 @@ evhttp_decode_uri_internal(const char *uri, size_t length, char *ret) in_query = 1; } else if (c == '+' && in_query) { c = ' '; - } else if (c == '%' && isxdigit((unsigned char)uri[i+1]) && - isxdigit((unsigned char)uri[i+2])) { + } else if (c == '%' && EVUTIL_ISXDIGIT(uri[i+1]) && + EVUTIL_ISXDIGIT(uri[i+2])) { char tmp[] = { uri[i+1], uri[i+2], '\0' }; c = (char)strtol(tmp, NULL, 16); i += 2; @@ -2254,7 +2253,7 @@ prefix_suffix_match(const char *pattern, const char *name, int ignorecase) default: if (c != *name) { if (!ignorecase || - tolower(c) != tolower(*name)) + EVUTIL_TOLOWER(c) != EVUTIL_TOLOWER(*name)) return (0); } ++name; -- cgit v1.2.1