1
0
Fork 0
mirror of https://gitlab.com/niansa/simpsh-httpd.git synced 2025-03-06 20:53:36 +01:00
simpsh-httpd/urlcheck.sh
2017-05-01 12:36:51 +02:00

30 lines
634 B
Bash

#! /bin/bash
# Blockiere Versuche, das restliche Dateisystem zu lesen
if [[ "$URL" == *..* ]]; then
export URL='/'
export FILE="$FILES"
fi
# Verhindere "/"-bug
if [ -d "$FILE" ]; then
if [[ "$URL" != */ ]]; then
export ANSWER='HTTP/1.0 302 Moved permanently
Location: '"${WEBSITE}${URL}"'/'
export CONTENTTYPE="$DEFAULTCONTENTTYPE"
. ./httpheaders.sh
export DONE=true
fi
fi
# Erkenne index.html
if [ -f "${FILE}index.html" ]; then
export URL="${URL}index.html"
export FILE="${FILE}index.html"
fi
# Erkenne index.php
if [ -f "${FILE}index.php" ]; then
export URL="${URL}index.php"
export FILE="${FILE}index.php"
fi