Blame


1 5c2e310e 2021-01-22 op #!/bin/sh
2 5c2e310e 2021-01-22 op
3 5c2e310e 2021-01-22 op set -e
4 5c2e310e 2021-01-22 op
5 a82d4dfa 2021-07-10 op if [ "${SKIP_RUNTIME_TESTS:-0}" -eq 1 ]; then
6 bffa7daa 2021-07-08 op echo
7 bffa7daa 2021-07-08 op echo "======================"
8 bffa7daa 2021-07-08 op echo "runtime tests skipped!"
9 bffa7daa 2021-07-08 op echo "======================"
10 bffa7daa 2021-07-08 op echo
11 bffa7daa 2021-07-08 op exit 0
12 bffa7daa 2021-07-08 op fi
13 bffa7daa 2021-07-08 op
14 02be96c6 2021-02-09 op ggflags=
15 02be96c6 2021-02-09 op
16 735336b2 2021-07-19 op port=10965
17 735336b2 2021-07-19 op
18 735336b2 2021-07-19 op config_common="
19 fb4102a5 2021-07-06 op ipv6 off
20 735336b2 2021-07-19 op port $port
21 735336b2 2021-07-19 op "
22 fb4102a5 2021-07-06 op
23 5c2e310e 2021-01-22 op # usage: config <global config> <stuff for localhost>
24 5c2e310e 2021-01-22 op # generates a configuration file reg.conf
25 5c2e310e 2021-01-22 op config() {
26 5c2e310e 2021-01-22 op cat <<EOF > reg.conf
27 fb4102a5 2021-07-06 op $config_common
28 5c2e310e 2021-01-22 op $1
29 5c2e310e 2021-01-22 op server "localhost" {
30 6ff23c67 2021-02-01 op cert "$PWD/cert.pem"
31 6ff23c67 2021-02-01 op key "$PWD/key.pem"
32 6ff23c67 2021-02-01 op root "$PWD/testdata"
33 5c2e310e 2021-01-22 op $2
34 5c2e310e 2021-01-22 op }
35 5c2e310e 2021-01-22 op EOF
36 5c2e310e 2021-01-22 op }
37 5c2e310e 2021-01-22 op
38 5c2e310e 2021-01-22 op checkconf() {
39 5c2e310e 2021-01-22 op ./../gmid -n -c reg.conf
40 5c2e310e 2021-01-22 op }
41 5c2e310e 2021-01-22 op
42 5c2e310e 2021-01-22 op # usage: get <path>
43 5c2e310e 2021-01-22 op # return the body of the request on stdout
44 5c2e310e 2021-01-22 op get() {
45 321341f6 2021-07-06 op ./gg -T30 -b $ggflags "gemini://localhost:10965/$1"
46 5c2e310e 2021-01-22 op }
47 5c2e310e 2021-01-22 op
48 5c2e310e 2021-01-22 op # usage: head <path>
49 5c2e310e 2021-01-22 op # return the meta response line on stdout
50 5c2e310e 2021-01-22 op head() {
51 321341f6 2021-07-06 op ./gg -T30 -h $ggflags "gemini://localhost:10965/$1"
52 5c2e310e 2021-01-22 op }
53 5c2e310e 2021-01-22 op
54 31a4993a 2021-01-23 op # usage: raw <path>
55 31a4993a 2021-01-23 op # return both header and body
56 31a4993a 2021-01-23 op raw() {
57 321341f6 2021-07-06 op ./gg -T30 $ggflags "gemini://localhost:10965/$1"
58 31a4993a 2021-01-23 op }
59 31a4993a 2021-01-23 op
60 5c2e310e 2021-01-22 op run() {
61 ca3f6756 2021-07-06 op ./../gmid -f -c reg.conf &
62 5c2e310e 2021-01-22 op pid=$!
63 31a4993a 2021-01-23 op # give gmid time to bind the port, otherwise we end up
64 31a4993a 2021-01-23 op # executing gg when gmid isn't ready yet.
65 31a4993a 2021-01-23 op sleep 1
66 5c2e310e 2021-01-22 op }
67 5c2e310e 2021-01-22 op
68 5c2e310e 2021-01-22 op # usage: check [exit-message]
69 5c2e310e 2021-01-22 op # check if gmid is still running
70 5c2e310e 2021-01-22 op check() {
71 5c2e310e 2021-01-22 op if ! ps $pid >/dev/null; then
72 5c2e310e 2021-01-22 op echo ${1:-"gmid crashed?"}
73 5c2e310e 2021-01-22 op exit 1
74 5c2e310e 2021-01-22 op fi
75 5c2e310e 2021-01-22 op }
76 5c2e310e 2021-01-22 op
77 afc025ff 2021-02-06 op restart() {
78 052c9d24 2021-03-20 op kill -HUP $pid
79 afc025ff 2021-02-06 op sleep 1
80 afc025ff 2021-02-06 op }
81 afc025ff 2021-02-06 op
82 5c2e310e 2021-01-22 op # quit gmid
83 5c2e310e 2021-01-22 op quit() {
84 052c9d24 2021-03-20 op kill $pid || true
85 5c2e310e 2021-01-22 op wait || true
86 5c2e310e 2021-01-22 op }
87 5c2e310e 2021-01-22 op
88 9f006a21 2021-02-07 op count() {
89 9f006a21 2021-02-07 op wc -l | xargs
90 9f006a21 2021-02-07 op }
91 9f006a21 2021-02-07 op
92 5c2e310e 2021-01-22 op # usage: eq a b errmsg
93 5c2e310e 2021-01-22 op # if a and b aren't equal strings, exit with errmsg
94 5c2e310e 2021-01-22 op eq() {
95 5c2e310e 2021-01-22 op if ! [ "$1" = "$2" ]; then
96 5c2e310e 2021-01-22 op echo "$3: \"$1\" not equal \"$2\""
97 5c2e310e 2021-01-22 op exit 1
98 5c2e310e 2021-01-22 op fi
99 5c2e310e 2021-01-22 op }
100 5c2e310e 2021-01-22 op
101 5c2e310e 2021-01-22 op onexit() {
102 5c2e310e 2021-01-22 op rm -f bigfile bigfile.sha
103 5c2e310e 2021-01-22 op quit
104 5c2e310e 2021-01-22 op }
105 5c2e310e 2021-01-22 op
106 735336b2 2021-07-19 op # configless tests
107 5c2e310e 2021-01-22 op
108 3e0164f4 2021-07-19 op ./../gmid -p $port -H localhost -d . testdata &
109 735336b2 2021-07-19 op pid=$!
110 735336b2 2021-07-19 op sleep 1
111 735336b2 2021-07-19 op
112 735336b2 2021-07-19 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
113 735336b2 2021-07-19 op eq "$(get /)" "# hello world$ln" "Unexpected body for /"
114 735336b2 2021-07-19 op echo OK GET / in configless mode
115 735336b2 2021-07-19 op quit
116 735336b2 2021-07-19 op
117 735336b2 2021-07-19 op # daemon tests
118 735336b2 2021-07-19 op
119 5c2e310e 2021-01-22 op trap 'onexit' INT TERM EXIT
120 5c2e310e 2021-01-22 op
121 5c2e310e 2021-01-22 op endl=`printf "\r\n"`
122 5c2e310e 2021-01-22 op lf=`echo`
123 5c2e310e 2021-01-22 op
124 5c2e310e 2021-01-22 op config "" ""
125 5c2e310e 2021-01-22 op checkconf
126 5c2e310e 2021-01-22 op run
127 5c2e310e 2021-01-22 op
128 5c2e310e 2021-01-22 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
129 5c2e310e 2021-01-22 op eq "$(get /)" "# hello world$ln" "Unexpected body for /"
130 5c2e310e 2021-01-22 op echo OK GET /
131 5c2e310e 2021-01-22 op
132 5c2e310e 2021-01-22 op eq "$(head /foo)" "51 not found" "Unexpected head /foo"
133 5c2e310e 2021-01-22 op eq "$(get /foo)" "" "Unexpected body /foo"
134 5c2e310e 2021-01-22 op echo OK GET /foo
135 5c2e310e 2021-01-22 op
136 5c2e310e 2021-01-22 op # should redirect if asked for a directory but without the trailing /
137 5c2e310e 2021-01-22 op eq "$(head /dir)" "30 /dir/" "Unexpected redirect for /dir"
138 5c2e310e 2021-01-22 op eq "$(get /dir)" "" "Unexpected body for redirect"
139 5c2e310e 2021-01-22 op echo OK GET /dir
140 5c2e310e 2021-01-22 op
141 5c2e310e 2021-01-22 op # 51 for a directory without index.gmi
142 5c2e310e 2021-01-22 op eq "$(head /dir/)" "51 not found" "Unexpected head for /"
143 5c2e310e 2021-01-22 op eq "$(get /dir/)" "" "Unexpected body for error"
144 5c2e310e 2021-01-22 op echo OK GET /dir/
145 5c2e310e 2021-01-22 op
146 5c2e310e 2021-01-22 op eq "$(head /dir/foo.gmi)" "20 text/gemini" "Unexpected head for /dir/foo.gmi"
147 5c2e310e 2021-01-22 op eq "$(get /dir/foo.gmi)" "# hello world$ln" "Unexpected body for /dir/foo.gmi"
148 5c2e310e 2021-01-22 op echo OK GET /dir/foo.gmi
149 5c2e310e 2021-01-22 op
150 5c2e310e 2021-01-22 op # try a big file
151 5c2e310e 2021-01-22 op eq "$(head /bigfile)" "20 application/octet-stream" "Unexpected head for /bigfile"
152 5c2e310e 2021-01-22 op get /bigfile > bigfile
153 5c2e310e 2021-01-22 op ./sha bigfile bigfile.sha
154 5c2e310e 2021-01-22 op eq "$(cat bigfile.sha)" "$(cat testdata/bigfile.sha)" "Unexpected sha for /bigfile"
155 5c2e310e 2021-01-22 op echo OK GET /bigfile
156 5c2e310e 2021-01-22 op
157 5c2e310e 2021-01-22 op # shouldn't be executing cgi scripts
158 5c2e310e 2021-01-22 op eq "$(head /hello)" "20 application/octet-stream" "Unexpected head for /hello"
159 5c2e310e 2021-01-22 op echo OK GET /hello
160 5c2e310e 2021-01-22 op
161 5c2e310e 2021-01-22 op check "should be running"
162 5c2e310e 2021-01-22 op
163 5c2e310e 2021-01-22 op # try with custom mime
164 d19951cf 2021-07-09 op config 'map "text/x-funny-text" to-ext "gmi"' 'default type "application/x-trash"'
165 5c2e310e 2021-01-22 op checkconf
166 afc025ff 2021-02-06 op restart
167 5c2e310e 2021-01-22 op
168 5c2e310e 2021-01-22 op eq "$(head /)" "20 text/x-funny-text" "Unexpected head for /"
169 5c2e310e 2021-01-22 op echo OK GET / with custom mime
170 5c2e310e 2021-01-22 op
171 5c2e310e 2021-01-22 op eq "$(head /hello)" "20 application/x-trash" "Unexpected head for /hello"
172 5c2e310e 2021-01-22 op echo OK GET /hello with custom mime
173 5c2e310e 2021-01-22 op
174 5c2e310e 2021-01-22 op check "should be running"
175 5c2e310e 2021-01-22 op
176 5c2e310e 2021-01-22 op # try with custom lang
177 5c2e310e 2021-01-22 op config '' 'lang "it"'
178 5c2e310e 2021-01-22 op checkconf
179 afc025ff 2021-02-06 op restart
180 5c2e310e 2021-01-22 op
181 5c2e310e 2021-01-22 op eq "$(head /)" "20 text/gemini; lang=it" "Unexpected head for /"
182 5c2e310e 2021-01-22 op echo OK GET / with custom lang
183 5c2e310e 2021-01-22 op
184 5c2e310e 2021-01-22 op check "should be running"
185 5c2e310e 2021-01-22 op
186 49b73ba1 2021-02-10 op # make sure we can use different lang in different location rules
187 49b73ba1 2021-02-10 op config '' 'lang "it" location "/en/*" { lang "en" } location "/de/*" { lang "de" }'
188 49b73ba1 2021-02-10 op checkconf
189 a4188b78 2021-02-12 op echo OK parse multiple locations correctly
190 49b73ba1 2021-02-10 op restart
191 49b73ba1 2021-02-10 op
192 9f006a21 2021-02-07 op # try with CGI scripts
193 87f2b68b 2021-02-02 op config '' 'cgi "*"'
194 5c2e310e 2021-01-22 op checkconf
195 afc025ff 2021-02-06 op restart
196 5c2e310e 2021-01-22 op
197 5c2e310e 2021-01-22 op eq "$(head /hello)" "20 text/gemini" "Unexpected head for /hello"
198 5c2e310e 2021-01-22 op eq "$(get /hello)" "# hello world$ln" "Unexpected body for /hello"
199 5c2e310e 2021-01-22 op echo OK GET /hello with cgi
200 5c2e310e 2021-01-22 op
201 5c2e310e 2021-01-22 op eq "$(head /slow)" "20 text/gemini" "Unexpected head for /slow"
202 5c2e310e 2021-01-22 op eq "$(get /slow)" "# hello world$ln" "Unexpected body for /slow"
203 5c2e310e 2021-01-22 op echo OK GET /slow with cgi
204 5c2e310e 2021-01-22 op
205 35744950 2021-02-01 op eq "$(head /err)" "42 CGI error" "Unexpected head for /err"
206 5c2e310e 2021-01-22 op eq "$(get /err)" "" "Unexpected body for /err"
207 5c2e310e 2021-01-22 op echo OK GET /err with cgi
208 5c2e310e 2021-01-22 op
209 6cdecad8 2021-01-23 op eq "$(raw /invalid | wc -c | xargs)" 2048 "Unexpected body for /invalid"
210 3309ef97 2021-01-23 op echo OK GET /invalid with cgi
211 3309ef97 2021-01-23 op
212 c836cdfa 2021-03-29 op eq "$(raw /max-length-reply | wc -c | xargs)" 1029 "Unexpected header for /max-length-reply"
213 c836cdfa 2021-03-29 op echo OK GET /max-length-reply with cgi
214 c836cdfa 2021-03-29 op
215 7b31a638 2021-01-24 op # try a big file
216 7b31a638 2021-01-24 op eq "$(head /serve-bigfile)" "20 application/octet-stream" "Unexpected head for /serve-bigfile"
217 7b31a638 2021-01-24 op get /bigfile > bigfile
218 7b31a638 2021-01-24 op ./sha bigfile bigfile.sha
219 7b31a638 2021-01-24 op eq "$(cat bigfile.sha)" "$(cat testdata/bigfile.sha)" "Unexpected sha for /serve-bigfile"
220 7b31a638 2021-01-24 op echo OK GET /serve-bigfile with cgi
221 7b31a638 2021-01-24 op
222 9f006a21 2021-02-07 op # ensure we split the query correctly
223 9f006a21 2021-02-07 op eq "$(get /env | awk /^-/ | count)" 1 "Unexpected number of arguments"
224 9f006a21 2021-02-07 op eq "$(get /env?foo | awk /^-/ | count)" 2 "Unexpected number of arguments"
225 9f006a21 2021-02-07 op eq "$(get /env?foo+bar | awk /^-/ | count)" 3 "Unexpected number of arguments"
226 9f006a21 2021-02-07 op eq "$(get /env?foo+bar=5 | awk /^-/ | count)" 1 "Unexpected number of arguments"
227 9f006a21 2021-02-07 op eq "$(get /env?foo+bar%3d5 | awk /^-/ | count)" 3 "Unexpected number of arguments"
228 9f006a21 2021-02-07 op
229 5c2e310e 2021-01-22 op check "should be running"
230 e7a2a99b 2021-01-24 op
231 e7a2a99b 2021-01-24 op config '' 'index "foo.gmi"'
232 e7a2a99b 2021-01-24 op checkconf
233 afc025ff 2021-02-06 op restart
234 e7a2a99b 2021-01-24 op
235 e7a2a99b 2021-01-24 op eq "$(head /dir/)" "20 text/gemini" "Unexpected head for /"
236 e7a2a99b 2021-01-24 op eq "$(get /dir/)" "# hello world$ln" "Unexpected body for error"
237 e7a2a99b 2021-01-24 op echo OK GET /dir/ with custom index
238 e7a2a99b 2021-01-24 op
239 e7a2a99b 2021-01-24 op check "should be running"
240 c8b74339 2021-01-24 op
241 49b73ba1 2021-02-10 op config '' 'location "/dir/*" { default type "text/plain" index "hello" }'
242 c8b74339 2021-01-24 op checkconf
243 afc025ff 2021-02-06 op restart
244 c8b74339 2021-01-24 op
245 c8b74339 2021-01-24 op eq "$(head /dir/hello)" "20 text/plain" "Unexpected head for /"
246 c8b74339 2021-01-24 op echo OK GET /dir/hello with location and default type
247 c8b74339 2021-01-24 op
248 252908e6 2021-01-24 op eq "$(head /dir/)" "20 text/plain" "Unexpected head for /dir/"
249 c8b74339 2021-01-24 op eq "$(get /dir/|tail -1)" 'echo "# hello world"' "Unexpected body for /dir/"
250 c8b74339 2021-01-24 op echo OK GET /dir/ with location and custom index
251 c8b74339 2021-01-24 op
252 c8b74339 2021-01-24 op check "should be running"
253 252908e6 2021-01-24 op
254 49b73ba1 2021-02-10 op config '' 'location "/dir/*" { auto index on }'
255 252908e6 2021-01-24 op checkconf
256 afc025ff 2021-02-06 op restart
257 252908e6 2021-01-24 op
258 252908e6 2021-01-24 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
259 252908e6 2021-01-24 op eq "$(get /)" "# hello world$ln" "Unexpected body for /"
260 252908e6 2021-01-24 op echo OK GET / with auto index
261 252908e6 2021-01-24 op
262 252908e6 2021-01-24 op eq "$(head /dir)" "30 /dir/" "Unexpected head for /dir"
263 252908e6 2021-01-24 op eq "$(head /dir/)" "20 text/gemini" "Unexpected head for /dir/"
264 5f715ce4 2021-02-02 op eq "$(get /dir/|wc -l|xargs)" "5" "Unexpected body for /dir/"
265 252908e6 2021-01-24 op echo OK GET /dir/ with auto index on
266 252908e6 2021-01-24 op
267 252908e6 2021-01-24 op check "should be running"
268 6abda252 2021-02-06 op
269 6abda252 2021-02-06 op # test block return and strip
270 6abda252 2021-02-06 op
271 6abda252 2021-02-06 op config '' 'location "*" { block }'
272 6abda252 2021-02-06 op checkconf
273 afc025ff 2021-02-06 op restart
274 6abda252 2021-02-06 op
275 6abda252 2021-02-06 op eq "$(head /)" "40 temporary failure" "Unexpected head for /"
276 6abda252 2021-02-06 op eq "$(get /)" "" "Unexpected body for /"
277 6abda252 2021-02-06 op echo OK GET / with block
278 6abda252 2021-02-06 op
279 6abda252 2021-02-06 op eq "$(head /nonexists)" "40 temporary failure" "Unexpected head for /nonexists"
280 6abda252 2021-02-06 op eq "$(get /nonexists)" "" "Unexpected body for /nonexists"
281 6abda252 2021-02-06 op echo OK GET /nonexists with block
282 6abda252 2021-02-06 op
283 6abda252 2021-02-06 op check "should be running"
284 6abda252 2021-02-06 op
285 6abda252 2021-02-06 op config '' '
286 6abda252 2021-02-06 op location "/dir" {
287 6abda252 2021-02-06 op strip 1
288 6abda252 2021-02-06 op block return 40 "%% %p %q %P %N test"
289 6abda252 2021-02-06 op }
290 6abda252 2021-02-06 op location "*" {
291 6abda252 2021-02-06 op strip 99
292 6abda252 2021-02-06 op block return 40 "%% %p %q %P %N test"
293 6abda252 2021-02-06 op }'
294 6abda252 2021-02-06 op checkconf
295 afc025ff 2021-02-06 op restart
296 6abda252 2021-02-06 op
297 6abda252 2021-02-06 op eq "$(head /dir/foo.gmi)" "40 % /foo.gmi 10965 localhost test"
298 6abda252 2021-02-06 op echo OK GET /dir/foo.gmi with strip and block
299 6abda252 2021-02-06 op
300 737a6b50 2021-04-30 op eq "$(head /bigfile)" "40 % / 10965 localhost test"
301 6abda252 2021-02-06 op echo OK GET /bigfile with strip and block
302 6abda252 2021-02-06 op
303 6abda252 2021-02-06 op check "should be running"
304 e3ddf390 2021-02-06 op
305 e3ddf390 2021-02-06 op # test the entrypoint
306 e3ddf390 2021-02-06 op
307 e3ddf390 2021-02-06 op config '' 'entrypoint "/env"'
308 e3ddf390 2021-02-06 op checkconf
309 e3ddf390 2021-02-06 op restart
310 afc025ff 2021-02-06 op
311 e3ddf390 2021-02-06 op eq "$(head /foo/bar)" "20 text/plain; lang=en" "Unknown head for /foo/bar"
312 e3ddf390 2021-02-06 op eq "$(get /foo/bar|grep PATH_INFO)" "PATH_INFO=/foo/bar" "Unexpected PATH_INFO"
313 e3ddf390 2021-02-06 op echo OK GET /foo/bar with entrypoint
314 e3ddf390 2021-02-06 op
315 02be96c6 2021-02-09 op # test with require ca
316 02be96c6 2021-02-09 op
317 02be96c6 2021-02-09 op config '' 'require client ca "'$PWD'/testca.pem"'
318 02be96c6 2021-02-09 op checkconf
319 02be96c6 2021-02-09 op restart
320 02be96c6 2021-02-09 op
321 02be96c6 2021-02-09 op eq "$(head /)" "60 client certificate required" "Unexpected head for /"
322 02be96c6 2021-02-09 op echo OK GET / without client certificate
323 02be96c6 2021-02-09 op
324 02be96c6 2021-02-09 op ggflags="-C valid.crt -K valid.key"
325 02be96c6 2021-02-09 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
326 02be96c6 2021-02-09 op echo OK GET / with valid client certificate
327 02be96c6 2021-02-09 op
328 02be96c6 2021-02-09 op ggflags="-C invalid.cert.pem -K invalid.key.pem"
329 02be96c6 2021-02-09 op eq "$(head /)" "61 certificate not authorised" "Unexpected head for /"
330 02be96c6 2021-02-09 op echo OK GET / with invalid client certificate
331 02be96c6 2021-02-09 op
332 02be96c6 2021-02-09 op ggflags=''
333 fdea6aa0 2021-04-30 op
334 fdea6aa0 2021-04-30 op
335 fdea6aa0 2021-04-30 op # test with root inside a location
336 fdea6aa0 2021-04-30 op
337 fdea6aa0 2021-04-30 op config '' 'location "/foo/*" { root "'$PWD'/testdata" strip 1 }'
338 fdea6aa0 2021-04-30 op checkconf
339 fdea6aa0 2021-04-30 op restart
340 fdea6aa0 2021-04-30 op
341 7aa92586 2021-04-30 op eq "$(head /foo)" "51 not found" "Unexpected head for /foo"
342 7aa92586 2021-04-30 op eq "$(head /foo/)" "20 text/gemini" "Unexpected head for /foo/"
343 0f2124e2 2021-06-12 op echo OK /foo and /foo/ with root inside location
344 7aa92586 2021-04-30 op
345 7aa92586 2021-04-30 op # how to match both /foo and /foo/*
346 7aa92586 2021-04-30 op config '' '
347 7aa92586 2021-04-30 op location "/foo" { block return 31 "%p/" }
348 7aa92586 2021-04-30 op location "/foo/*" { root "'$PWD'/testdata" strip 1 }
349 7aa92586 2021-04-30 op '
350 7aa92586 2021-04-30 op checkconf
351 7aa92586 2021-04-30 op restart
352 fdea6aa0 2021-04-30 op
353 7aa92586 2021-04-30 op eq "$(head /foo)" "31 /foo/" "Unexpected head for /foo"
354 fdea6aa0 2021-04-30 op eq "$(head /foo/)" "20 text/gemini" "Unexpected head for /foo/"
355 0f2124e2 2021-06-12 op echo OK /foo and /foo/ with root inside location
356 0f2124e2 2021-06-12 op
357 0f2124e2 2021-06-12 op # test with fastcgi
358 0f2124e2 2021-06-12 op
359 0f2124e2 2021-06-12 op # NB: the fcgi spawn is NOT supported outside of this test suite
360 0f2124e2 2021-06-12 op
361 0f2124e2 2021-06-12 op config 'prefork 1' 'fastcgi spawn "'$PWD'/fcgi-test"'
362 0f2124e2 2021-06-12 op checkconf
363 0f2124e2 2021-06-12 op restart
364 0f2124e2 2021-06-12 op
365 0f2124e2 2021-06-12 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
366 0f2124e2 2021-06-12 op eq "$(get /)" "# Hello, world!" "Unexpected body for /"
367 0f2124e2 2021-06-12 op echo OK GET / with fastcgi
368 fb4102a5 2021-07-06 op
369 fb4102a5 2021-07-06 op # test macro expansion
370 fb4102a5 2021-07-06 op
371 fb4102a5 2021-07-06 op cat <<EOF > reg.conf
372 fb4102a5 2021-07-06 op pwd = "$PWD"
373 fb4102a5 2021-07-06 op $config_common
374 fb4102a5 2021-07-06 op
375 fb4102a5 2021-07-06 op server "localhost" {
376 fb4102a5 2021-07-06 op # the quoting of \$ is for sh
377 fb4102a5 2021-07-06 op cert \$pwd "/cert.pem"
378 fb4102a5 2021-07-06 op key \$pwd "/key.pem"
379 fb4102a5 2021-07-06 op root \$pwd "/testdata"
380 fb4102a5 2021-07-06 op }
381 fb4102a5 2021-07-06 op EOF
382 fb4102a5 2021-07-06 op checkconf
383 fb4102a5 2021-07-06 op restart
384 fb4102a5 2021-07-06 op
385 fb4102a5 2021-07-06 op eq "$(head /)" "20 text/gemini" "Unexpected head for /"
386 fb4102a5 2021-07-06 op eq "$(get /)" "# hello world$ln" "Unexpected body for /"
387 fb4102a5 2021-07-06 op echo OK GET / with macro expansion