We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d649bc4 commit 48c2f25Copy full SHA for 48c2f25
bashttpd.sh
@@ -47,6 +47,20 @@ function get_content_length() {
47
CONTENT_LENGTH=$( echo ${CONTENT_BODY} | wc -c )
48
}
49
50
+function serve_500() {
51
+ echo "HTTP/1.0 500 Internal Server Error"
52
+ echo "$REPLY_HEADERS"
53
+ echo "Content-Type: text/plain"
54
+ echo
55
+ echo "Internal Server Error"
56
+ exit
57
+}
58
+
59
+if ! [ -d "$DOCROOT" ]; then
60
+ echo >&2 "Error: \$DOCROOT '$DOCROOT' does not exist."
61
+ serve_500
62
+fi
63
64
while read line; do
65
# If we've reached the end of the headers, break.
66
line=$( echo ${line} | tr -d '\r' )
0 commit comments