aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-06-29 12:21:09 -0400
committerDavid Robillard <d@drobilla.net>2017-06-29 12:21:09 -0400
commit195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8 (patch)
tree952b067c7ace8afb1f78cb51ac032d18565c94a8 /src/uri.c
parent21211d73053d0a66a1da601472c68598cfc53595 (diff)
downloadserd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.tar.gz
serd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.tar.bz2
serd-195e4bcff3c4dfd3fe8bbf0df57d53ce89ca99e8.zip
Fix strict parsing of abolute URI schemes
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/uri.c b/src/uri.c
index 6b4fc07e..fcea3b62 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -103,16 +103,12 @@ serd_uri_string_has_scheme(const uint8_t* utf8)
if (!utf8 || !is_alpha(utf8[0])) {
return false; // Invalid scheme initial character, URI is relative
}
+
for (uint8_t c; (c = *++utf8) != '\0';) {
- switch (c) {
- case ':':
+ if (!is_uri_scheme_char(c)) {
+ return false;
+ } else if (c == ':') {
return true; // End of scheme
- case '+': case '-': case '.':
- break; // Valid scheme character, continue
- default:
- if (!is_alpha(c) && !is_digit(c)) {
- return false; // Invalid scheme character
- }
}
}