diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-10 17:22:13 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-10 17:22:13 -0700 |
commit | 474a28663f2871c91ea758c1fa4e0cf9bc7326a5 (patch) | |
tree | a741bea4e5c94237af2e2c7e2f117e770e8635b8 /examples | |
parent | 96f3a7607ffbdb349a4c2eff35efdf11b8d35a4e (diff) |
CGI improvements
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/cgi/cgi-bin/cowsay | 3 | ||||
-rwxr-xr-x | examples/cgi/cgi-bin/environ | 8 | ||||
-rw-r--r-- | examples/cgi/main.go | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/examples/cgi/cgi-bin/cowsay b/examples/cgi/cgi-bin/cowsay index e63e909..fc1f4e5 100755 --- a/examples/cgi/cgi-bin/cowsay +++ b/examples/cgi/cgi-bin/cowsay @@ -2,8 +2,7 @@ set -euo pipefail -if [ -z "$QUERY_STRING" ]; -then +if [[ -z "$QUERY_STRING" ]]; then printf "10 Enter a phrase.\r\n" exit 0 fi diff --git a/examples/cgi/cgi-bin/environ b/examples/cgi/cgi-bin/environ new file mode 100755 index 0000000..62ca15a --- /dev/null +++ b/examples/cgi/cgi-bin/environ @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +set -euo pipefail + +printf "20 text/gemini\r\n" +echo "\`\`\`env(1) output" +env +echo "\`\`\`" diff --git a/examples/cgi/main.go b/examples/cgi/main.go index e784876..d1df220 100644 --- a/examples/cgi/main.go +++ b/examples/cgi/main.go @@ -21,7 +21,7 @@ func main() { } // make use of a CGI request handler - cgiHandler := cgi.CGIHandler("/cgi-bin", "cgi-bin") + cgiHandler := cgi.CGIDirectory("/cgi-bin", "./cgi-bin") // add stdout logging to the request handler handler := guslog.Requests(os.Stdout, nil)(cgiHandler) |