Commit 485faf1b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

decode_URI: simplify/relax non-encoded characters handling

Since non-ASCII or non-printable characters are not supposed to occur
in URL, it does not matter much how they are dealt with.

The caller of decode_URI() can anyway not assume anything about the
decoded string. In particular, decode_URI() does not validate UTF-8
sequences in any case.
parent f71b33de
......@@ -69,7 +69,7 @@ char *decode_URI (char *str)
if (in == NULL)
return NULL;
signed char c;
char c;
while ((c = *(in++)) != '\0')
{
if (c == '%')
......@@ -82,12 +82,7 @@ char *decode_URI (char *str)
*(out++) = strtoul (hex, NULL, 0x10);
}
else
if (c >= 32)
*(out++) = c;
else
/* Inserting non-ASCII or non-printable characters is unsafe,
* and no sane browser will send these unencoded */
*(out++) = '?';
}
*out = '\0';
return str;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment