Adapt bin/static to new binary structure
This commit is contained in:
+5
-5
@@ -5,17 +5,17 @@ PATHNAME="$2"
|
|||||||
REAL="$(realpath --relative-base="$BASE" "$BASE/$PATHNAME")"
|
REAL="$(realpath --relative-base="$BASE" "$BASE/$PATHNAME")"
|
||||||
|
|
||||||
if [ ! -f "$BASE/$PATHNAME" ]; then
|
if [ ! -f "$BASE/$PATHNAME" ]; then
|
||||||
response /status 404
|
kapow set /response/status 404
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
case $REAL in
|
case $REAL in
|
||||||
"/"*)
|
"/"*)
|
||||||
response /status 403
|
kapow set /response/status 403
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
response /status 200
|
kapow set /response/status 200
|
||||||
response /headers/Content-Type "$(python -m mimetypes "$BASE/$REAL" | awk '/type:/ {print $2; exit 0}; !/type:/ {print "application/octet-stream"}')"
|
kapow set /response/headers/Content-Type "$(python -m mimetypes "$BASE/$REAL" | awk '/type:/ {print $2; exit 0}; !/type:/ {print "application/octet-stream"}')"
|
||||||
response /body < "$BASE/$REAL"
|
kapow set /response/body < "$BASE/$REAL"
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user