yahns.git  about / heads / tags
sleepy, multi-threaded, non-blocking application server for Ruby
blob ce9c372c3884471d72d0d75910b55dcce25f8900 826 bytes (raw)
$ git show HEAD:test/test_extras_exec_cgi.sh	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
#!/bin/sh
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (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
	;;
/pid)
	stdhead
	echo $$
	;;
/die)
	if test -n "$HTTP_X_PID_DEST"
	then
		# obviously this is only for testing on a local machine:
		echo $$ > "$HTTP_X_PID_DEST"
		exit 1
	else
		echo Content-Type: text/plain
		echo Status: 400 Bad Request
		echo Content-Length: 0
		echo
	fi
	;;
/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

git clone git://yhbt.net/yahns.git
git clone https://yhbt.net/yahns.git