about summary refs log tree commit homepage
path: root/test/test_extras_exec_cgi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_extras_exec_cgi.sh')
-rwxr-xr-xtest/test_extras_exec_cgi.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_extras_exec_cgi.sh b/test/test_extras_exec_cgi.sh
new file mode 100755
index 0000000..e580773
--- /dev/null
+++ b/test/test_extras_exec_cgi.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
+# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
+
+# test CGI program, this remains portable POSIX shell (not bash)
+set -e
+
+stdhead () {
+        echo Content-Type: text/plain
+        echo Status: 200 OK
+        echo
+}
+
+case $PATH_INFO in
+/)
+        stdhead
+        echo HIHI
+        ;;
+/env)
+        stdhead
+        env
+        ;;
+/known-length)
+        echo Content-Type: text/plain
+        echo Status: 200 OK
+        echo Content-Length: 5
+        echo
+        echo HIHI
+        ;;
+*)
+        echo Content-Type: text/plain
+        echo Status: 404 Not Found
+        echo
+        ;;
+esac