commit - cd761624942ce5bd06fcf939400ed41b8166d37d
commit + afc025ff600c11e5cbe8794b944b560492290cce
blob - 96ac135f8e0e6ce4dcfe4e9df6f56c859e6f4447
blob + 4d53f1ccd29af150e22849189b82db6dd54b3649
--- regress/runtime
+++ regress/runtime
fi
}
+restart() {
+ pkill -SIGHUP gmid
+ sleep 1
+}
+
# quit gmid
quit() {
pkill gmid || true
echo OK GET /hello
check "should be running"
-quit
# try with custom mime
config 'mime "text/x-funny-text" "gmi"' 'default type "application/x-trash"'
checkconf
-run
+restart
eq "$(head /)" "20 text/x-funny-text" "Unexpected head for /"
echo OK GET / with custom mime
echo OK GET /hello with custom mime
check "should be running"
-quit
# try with custom lang
config '' 'lang "it"'
checkconf
-run
+restart
eq "$(head /)" "20 text/gemini; lang=it" "Unexpected head for /"
echo OK GET / with custom lang
check "should be running"
-quit
# finally try with CGI scripts
config '' 'cgi "*"'
checkconf
-run
+restart
eq "$(head /hello)" "20 text/gemini" "Unexpected head for /hello"
eq "$(get /hello)" "# hello world$ln" "Unexpected body for /hello"
echo OK GET /serve-bigfile with cgi
check "should be running"
-quit
config '' 'index "foo.gmi"'
checkconf
-run
+restart
eq "$(head /dir/)" "20 text/gemini" "Unexpected head for /"
eq "$(get /dir/)" "# hello world$ln" "Unexpected body for error"
echo OK GET /dir/ with custom index
check "should be running"
-quit
config '' 'location "/dir/" { default type "text/plain" index "hello" }'
checkconf
-run
+restart
eq "$(head /dir/hello)" "20 text/plain" "Unexpected head for /"
echo OK GET /dir/hello with location and default type
echo OK GET /dir/ with location and custom index
check "should be running"
-quit
config '' 'location "/dir/" { auto index on }'
checkconf
-run
+restart
eq "$(head /)" "20 text/gemini" "Unexpected head for /"
eq "$(get /)" "# hello world$ln" "Unexpected body for /"
echo OK GET /dir/ with auto index on
check "should be running"
-quit
# test block return and strip
config '' 'location "*" { block }'
checkconf
-run
+restart
eq "$(head /)" "40 temporary failure" "Unexpected head for /"
eq "$(get /)" "" "Unexpected body for /"
echo OK GET /nonexists with block
check "should be running"
-quit
config '' '
location "/dir" {
block return 40 "%% %p %q %P %N test"
}'
checkconf
-run
+restart
eq "$(head /dir/foo.gmi)" "40 % /foo.gmi 10965 localhost test"
echo OK GET /dir/foo.gmi with strip and block
echo OK GET /bigfile with strip and block
check "should be running"
+
quit