aboutsummaryrefslogtreecommitdiff
path: root/regress/runtime
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-06 17:22:37 +0000
committerOmar Polo <op@omarpolo.com>2021-02-06 17:22:37 +0000
commit6abda252e960943a302f7a945b1d008e463ea316 (patch)
treea8645d3fa2e531116222aee83e6ccb282f1602e9 /regress/runtime
parentdaac4a945284dd0f8baa3f35234981f7bc0426da (diff)
added ``block return'' and ``strip'' options
Diffstat (limited to 'regress/runtime')
-rwxr-xr-xregress/runtime38
1 files changed, 38 insertions, 0 deletions
diff --git a/regress/runtime b/regress/runtime
index b114beb..96ac135 100755
--- a/regress/runtime
+++ b/regress/runtime
@@ -220,3 +220,41 @@ echo OK GET /dir/ with auto index on
check "should be running"
quit
+
+# test block return and strip
+
+config '' 'location "*" { block }'
+checkconf
+run
+
+eq "$(head /)" "40 temporary failure" "Unexpected head for /"
+eq "$(get /)" "" "Unexpected body for /"
+echo OK GET / with block
+
+eq "$(head /nonexists)" "40 temporary failure" "Unexpected head for /nonexists"
+eq "$(get /nonexists)" "" "Unexpected body for /nonexists"
+echo OK GET /nonexists with block
+
+check "should be running"
+quit
+
+config '' '
+location "/dir" {
+ strip 1
+ block return 40 "%% %p %q %P %N test"
+}
+location "*" {
+ strip 99
+ block return 40 "%% %p %q %P %N test"
+}'
+checkconf
+run
+
+eq "$(head /dir/foo.gmi)" "40 % /foo.gmi 10965 localhost test"
+echo OK GET /dir/foo.gmi with strip and block
+
+eq "$(head /bigfile)" "40 % 10965 localhost test"
+echo OK GET /bigfile with strip and block
+
+check "should be running"
+quit