/rc/bin/rc-httpd/handlers/{dir-index, serve-static}: commit the correct files this time (thanks, igor)

This commit is contained in:
glenda 2022-04-01 01:59:47 +00:00
parent 60ef662b98
commit 241667b933
2 changed files with 9 additions and 2 deletions

View file

@ -2,6 +2,10 @@
PATH_INFO=`{echo $PATH_INFO | urlencode -d}
full_path=$"FS_ROOT^$"PATH_INFO
full_path=$"full_path
if(! ~ `{cleanname -d$FS_ROOT $full_path} `{cleanname $FS_ROOT}^*){
error 503
exit
}
if(! test -d $full_path){
error 404
exit
@ -14,8 +18,7 @@ builtin cd $full_path
if(~ $"NOINDEXFILE ^ $"NOINDEX ''){
ifile=index.htm*
if(! ~ $ifile(1) *'*'){
PATH_INFO=$ifile(1)
FS_ROOT=''
PATH_INFO=$PATH_INFO^$ifile(1)
exec serve-static
}
}

View file

@ -1,6 +1,10 @@
#!/bin/rc
full_path=`{echo $"FS_ROOT^$"PATH_INFO | urlencode -d}
full_path=$"full_path
if(! ~ `{cleanname -d$FS_ROOT $full_path} `{cleanname $FS_ROOT}^*){
error 503
exit
}
if(~ $full_path */)
error 503
if(test -d $full_path){