PyHP/pyhi-cgi.sh

17 lines
376 B
Bash
Raw Normal View History

2022-04-06 07:09:27 +02:00
#!/usr/bin/env bash
if [ -z "$PYHP" ]; then
PYHP=""$(dirname "$0")"/pyhp.py"
fi
HYPERTEXT=$("$PYHP" "$PATH_TRANSLATED" | python3 -)
# check for headers, if present assume the pyh file is going to handle them
if head -n1 <<< "$HYPERTEXT" | grep "[A-Za-z][A-Za-z0-9\-]*: " > /dev/null 2>&1; then
true
else
echo -ne "Content-type: text/html\\n\\n"
fi
echo "$HYPERTEXT"