aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-07-19 13:15:44 +0200
committerOmar Polo <op@omarpolo.com>2021-07-19 13:15:44 +0200
commit735336b21edbca50b1650df091ed2dad47f96c27 (patch)
treed6723f14ee206ba4d3961e2151f0c8b207bc62ab
parentabc8801d6064304c627cd75ed1f8c585d51346de (diff)
downloadgmid-735336b21edbca50b1650df091ed2dad47f96c27.tar.gz
gmid-735336b21edbca50b1650df091ed2dad47f96c27.tar.bz2
unbreak configless mode
An un-initialized field in the configless code path leads to a crash on the first request.
-rw-r--r--ChangeLog4
-rw-r--r--gmid.c1
-rwxr-xr-xregress/runtime21
3 files changed, 22 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c7fce52..9014989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-07-19 Omar Polo <op@omarpolo.com>
+
+ * gmid.c (setup_configless): unbreak configless mode
+
2021-07-13 Anna “CyberTailor”
* parse.y (yyerror): error and warning messages are prefixed with "error:" and "warning:"
diff --git a/gmid.c b/gmid.c
index 5d6e1cc..01a1684 100644
--- a/gmid.c
+++ b/gmid.c
@@ -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);
diff --git a/regress/runtime b/regress/runtime
index 32ab472..f156d6a 100755
--- a/regress/runtime
+++ b/regress/runtime
@@ -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