mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-26 16:54:42 +00:00
Allow .well-known/ hidden paths (#499)
This commit is contained in:
parent
7e2eae5c15
commit
439ad21b12
1 changed files with 5 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
||||||
*
|
*
|
||||||
* 1. The substring "//" is disallowed.
|
* 1. The substring "//" is disallowed.
|
||||||
* 2. We won't serve hidden files (segment starts with '.').
|
* 2. We won't serve hidden files (segment starts with '.').
|
||||||
|
* The only exception is `/.well-known/`.
|
||||||
* 3. We won't serve paths with segments equal to "." or "..".
|
* 3. We won't serve paths with segments equal to "." or "..".
|
||||||
*
|
*
|
||||||
* It is assumed that the URI parser already took care of percent
|
* It is assumed that the URI parser already took care of percent
|
||||||
|
@ -66,7 +67,10 @@ bool IsAcceptablePath(const char *data, size_t size) {
|
||||||
x = '/';
|
x = '/';
|
||||||
}
|
}
|
||||||
if (y == '/') {
|
if (y == '/') {
|
||||||
if (x == '.') return false;
|
if (x == '.' && // allow /.well-known/ in the first position
|
||||||
|
(p - data > 2 ||
|
||||||
|
size < 13 ||
|
||||||
|
memcmp(data, "/.well-known/", 13) != 0)) return false;
|
||||||
if (x == '/' && t) return false;
|
if (x == '/' && t) return false;
|
||||||
}
|
}
|
||||||
y = x;
|
y = x;
|
||||||
|
|
Loading…
Add table
Reference in a new issue