http: URL pattern matcher fixes.

This commit is contained in:
2024-11-02 20:10:55 -04:00
parent a09fefab5e
commit 30d108fc35
4 changed files with 35 additions and 25 deletions

View File

@ -130,7 +130,7 @@ static void _http_allocate_buffer(uv_handle_t* handle, size_t suggested_size, uv
bool tf_http_pattern_matches(const char* pattern, const char* path)
{
if (!pattern || !*pattern)
if (!*pattern && !*path)
{
return true;
}
@ -156,12 +156,14 @@ bool tf_http_pattern_matches(const char* pattern, const char* path)
{
while (true)
{
if (((path[j] >= 'a' && path[j] <= 'z') || (path[j] >= 'A' && path[j] <= 'Z') || (path[j] >= '0' && path[j] <= '9')) &&
tf_http_pattern_matches(pattern + i + k_word_len, path + j + 1))
if ((path[j] >= 'a' && path[j] <= 'z') || (path[j] >= 'A' && path[j] <= 'Z') || (path[j] >= '0' && path[j] <= '9'))
{
return true;
if (tf_http_pattern_matches(pattern + i + k_word_len, path + j + 1))
{
return true;
}
}
if (!path[j])
else
{
break;
}