1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

uri_parser: Fix relative recognition

Relative refernces with colons in their names can not be told by their
first character alone.
This commit is contained in:
chrysn 2020-04-03 15:22:13 +02:00
parent 2ec0fee1fa
commit 050af95666

View File

@ -218,6 +218,17 @@ bool uri_parser_is_absolute(const char *uri, size_t uri_len)
/* relative */
return false;
}
for (int i = 0; &uri[i] < colon; ++i) {
if (!(((uri[i] >= 'A') && (uri[i] <= 'Z')) ||
((uri[i] >= 'a') && (uri[i] <= 'z')) ||
((uri[i] >= '0') && (uri[i] <= '9')) ||
(uri[i] == '+') ||
(uri[i] == '-') ||
(uri[i] == '.'))) {
/* relative */
return false;
}
}
/* absolute */
return true;