allow ';' in URLs, needed for data URLs

This commit is contained in:
Christian Grothoff 2021-08-03 21:50:54 +02:00
parent 5fc2e72a2a
commit 06676e72cb
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -27,8 +27,8 @@
* be urlencoded.
*
* @param c character to look at
* @return #GNUNET_YES if @a c needs to be urlencoded,
* #GNUNET_NO otherwise
* @return true if @a c needs to be urlencoded,
* false otherwise
*/
static bool
is_reserved (char c)
@ -48,11 +48,11 @@ is_reserved (char c)
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
case '-': case '.': case '_': case '~':
return GNUNET_NO;
return false;
default:
break;
}
return GNUNET_YES;
return true;
}
@ -68,7 +68,7 @@ urlencode_len (const char *s)
{
size_t len = 0;
for (; *s != '\0'; len++, s++)
if (GNUNET_YES == is_reserved (*s))
if (is_reserved (*s))
len += 2;
return len;
}
@ -372,7 +372,7 @@ TALER_url_valid_charset (const char *url)
for (unsigned int i = 0; '\0' != url[i]; i++)
{
#define ALLOWED_CHARACTERS \
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/:&?-.,=_~%"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/:;&?-.,=_~%"
if (NULL == strchr (ALLOWED_CHARACTERS,
(int) url[i]))
return false;