Compare commits
No commits in common. "8844d4861164e760d8719df819dff20761f64946" and "aff67740f8f9488ea662ed7a94b10d86c9a10662" have entirely different histories.
8844d48611
...
aff67740f8
|
@ -6,6 +6,4 @@ An example file outlining the format is provided.
|
|||
|
||||
# How to use:
|
||||
|
||||
Put `pyhi-cgi.sh` somewhere where the server will execute it as CGI script with the environment variable `PYHP` set to point to `pyhp.py`. If the environment variable is unset, `pyhi-cgi.sh` will try to find `pyhp.py` in the same directory as it itself is. Then configure the web server to run `.pyh` files using `pyhi-cgi.sh` as a cgi script.
|
||||
|
||||
Alternatively, put `pyhi.sh` and `pyhp.py` somewhere and run `pyhi.sh` with the `.pyh` file as the first argument. Any other command line arguments will be passed to the `.pyh` file. The same `PYHP` environment variable can be used as described above.
|
||||
Put `pyhi.sh` and `pyhp.py` somewhere where your web server can execute them, then configure said web server to execute `.pyh` files using `pyhi.sh`.
|
16
pyhi-cgi.sh
16
pyhi-cgi.sh
|
@ -1,16 +0,0 @@
|
|||
#!/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"
|
|
@ -7,4 +7,13 @@ fi
|
|||
PYH="$1"
|
||||
shift
|
||||
|
||||
"$PYHP" "$PYH" | python3 - "$@"
|
||||
HYPERTEXT=$("$PYHP" "$PYH" | 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\-]*: "; then
|
||||
true
|
||||
else
|
||||
echo -ne "Content-type: text/html\\n\\n"
|
||||
fi
|
||||
|
||||
echo "$HYPERTEXT"
|
Loading…
Reference in New Issue