unbreak configless mode

An un-initialized field in the configless code path leads to a crash
on the first request.
This commit is contained in:
Omar Polo 2021-07-19 11:15:44 +00:00
parent 8068d2ff33
commit e65ac404d1
3 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2021-07-19 Omar Polo <op@omarpolo.com>
* gmid.c (setup_configless): unbreak configless mode
2021-07-11 Omar Polo <op@omarpolo.com>
* configure (VERSION): 1.7.1 tagged

1
gmid.c
View File

@ -524,6 +524,7 @@ setup_configless(int argc, char **argv, const char *cgi)
TAILQ_INSERT_HEAD(&hosts, host, vhosts);
loc = xcalloc(1, sizeof(*loc));
loc->fcgi = -1;
TAILQ_INSERT_HEAD(&host->locations, loc, locations);
serve(argc, argv, NULL);

View File

@ -13,10 +13,12 @@ fi
ggflags=
config_common='
port=10965
config_common="
ipv6 off
port 10965
'
port $port
"
# usage: config <global config> <stuff for localhost>
# generates a configuration file reg.conf
@ -101,7 +103,18 @@ onexit() {
quit
}
# tests
# configless tests
./../gmid -p $port testdata &
pid=$!
sleep 1
eq "$(head /)" "20 text/gemini" "Unexpected head for /"
eq "$(get /)" "# hello world$ln" "Unexpected body for /"
echo OK GET / in configless mode
quit
# daemon tests
trap 'onexit' INT TERM EXIT