http: URL pattern matcher fixes.
This commit is contained in:
12
src/http.c
12
src/http.c
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user