mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-02 23:18:44 +00:00
parent
4abae20172
commit
1e3c5e10ad
2 changed files with 7 additions and 0 deletions
|
@ -961,6 +961,10 @@ FUNCTIONS
|
|||
request routing needed for serving assets. This function returns
|
||||
true if the request was resolved. If it was resolved, then your
|
||||
OnHttpRequest request handler can still set additional headers.
|
||||
Note that the asset needs to have "read other" permissions;
|
||||
otherwise this function logs a warning and returns 403 Forbidden.
|
||||
If this is undesirable, use GetAssetMode and ServeAsset to bypass
|
||||
the check.
|
||||
|
||||
ServeAsset(path:str)
|
||||
Instructs redbean to serve static asset at path. This function
|
||||
|
|
|
@ -6231,6 +6231,9 @@ static char *RoutePath(const char *path, size_t pathlen) {
|
|||
struct Asset *a;
|
||||
DEBUGF("(srvr) RoutePath(%`'.*s)", pathlen, path);
|
||||
if ((a = GetAsset(path, pathlen))) {
|
||||
// only allow "read other" permissions for security
|
||||
// and consistency with handling of "external" files
|
||||
// in this and other webservers
|
||||
if ((m = GetMode(a)) & 0004) {
|
||||
if (!S_ISDIR(m)) {
|
||||
return HandleAsset(a, path, pathlen);
|
||||
|
|
Loading…
Add table
Reference in a new issue