mirror of
https://gitlab.com/niansa/simpsh-httpd.git
synced 2025-03-06 20:53:36 +01:00
30 lines
634 B
Bash
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
|