forked from cory/tildefriends
Fix /speedscope/ => deps/speedscope/index.html.
This commit is contained in:
parent
ba6da856bb
commit
5ca5323782
@ -147,12 +147,17 @@ static bool _http_pattern_matches(const char* pattern, const char* path, bool is
|
|||||||
|
|
||||||
if (pattern[i] == '*')
|
if (pattern[i] == '*')
|
||||||
{
|
{
|
||||||
for (; path[j]; j++)
|
while (true)
|
||||||
{
|
{
|
||||||
if (_http_pattern_matches(pattern + i + 1, path + j, strchr(pattern + i + 1, '*') != NULL))
|
if (_http_pattern_matches(pattern + i + 1, path + j, strchr(pattern + i + 1, '*') != NULL))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!path[j])
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !pattern[i] && !path[j];
|
return !pattern[i] && !path[j];
|
||||||
|
@ -626,11 +626,15 @@ static const char* _ext_to_content_type(const char* ext)
|
|||||||
{
|
{
|
||||||
if (ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
if (strcmp(ext, ".js") == 0 || strcmp(ext, ".mjs") == 0)
|
if (strcmp(ext, ".html") == 0)
|
||||||
|
{
|
||||||
|
return "text/html; charset=UTF-8";
|
||||||
|
}
|
||||||
|
else if (strcmp(ext, ".js") == 0 || strcmp(ext, ".mjs") == 0)
|
||||||
{
|
{
|
||||||
return "text/javascript; charset=UTF-8";
|
return "text/javascript; charset=UTF-8";
|
||||||
}
|
}
|
||||||
if (strcmp(ext, ".css") == 0)
|
else if (strcmp(ext, ".css") == 0)
|
||||||
{
|
{
|
||||||
return "text/css; charset=UTF-8";
|
return "text/css; charset=UTF-8";
|
||||||
}
|
}
|
||||||
@ -748,6 +752,11 @@ static void _httpd_endpoint_static(tf_http_request_t* request)
|
|||||||
is_core = is_core || (after && i == 0);
|
is_core = is_core || (after && i == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(request->path, "/speedscope/") == 0)
|
||||||
|
{
|
||||||
|
after = "index.html";
|
||||||
|
}
|
||||||
|
|
||||||
if (!after || strstr(after, ".."))
|
if (!after || strstr(after, ".."))
|
||||||
{
|
{
|
||||||
const char* k_payload = tf_http_status_text(404);
|
const char* k_payload = tf_http_status_text(404);
|
||||||
|
Loading…
Reference in New Issue
Block a user