From 9941e441f1c542ef7781ae21f86b70d82425aaa2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 1 Mar 2025 00:01:02 +0100 Subject: [PATCH] urlapi: rewrite the macro to avoid ISSPACE --- lib/urlapi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/urlapi.c b/lib/urlapi.c index 060ccec151..06adda1127 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -128,10 +128,6 @@ static const char *find_host_sep(const char *url) /* convert CURLcode to CURLUcode */ #define cc2cu(x) ((x) == CURLE_TOO_LARGE ? CURLUE_TOO_LARGE : \ CURLUE_OUT_OF_MEMORY) -/* - * Decide whether a character in a URL must be escaped. - */ -#define urlchar_needs_escaping(c) (!(ISCNTRL(c) || ISSPACE(c) || ISGRAPH(c))) static const char hexdigits[] = "0123456789abcdef"; /* urlencode_str() writes data into an output dynbuf and URL-encodes the @@ -167,7 +163,7 @@ static CURLUcode urlencode_str(struct dynbuf *o, const char *url, else result = Curl_dyn_addn(o, "+", 1); } - else if(urlchar_needs_escaping(*iptr)) { + else if((*iptr < ' ') || (*iptr >= 0x7f)) { char out[3]={'%'}; out[1] = hexdigits[*iptr >> 4]; out[2] = hexdigits[*iptr & 0xf];