From 32913c35cd5f36b00056d3e239c0e85f1f0ed000 Mon Sep 17 00:00:00 2001 From: RenĂ© Wagner Date: Wed, 27 Jan 2021 20:57:18 +0100 Subject: implement handling of ROUTE_EXACT definitions This patchset implements the handling of exact routes as described in gmnisrvini(5). --- src/config.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index 7c1b655..c4c152c 100644 --- a/src/config.c +++ b/src/config.c @@ -152,12 +152,16 @@ conf_ini_handler(void *user, const char *section, const char *spec; char hostname[1024 + 1]; enum gmnisrv_routing routing; - size_t hostln = strcspn(section, ":~"); + size_t hostln = strcspn(section, "=:~"); switch (section[hostln]) { case '\0': routing = ROUTE_PATH; spec = "/"; break; + case '=': + routing = ROUTE_EXACT; + spec = §ion[hostln + 1]; + break; case ':': routing = ROUTE_PATH; spec = §ion[hostln + 1]; @@ -196,6 +200,7 @@ conf_ini_handler(void *user, const char *section, switch (route->routing) { case ROUTE_PATH: + case ROUTE_EXACT: route->path = strdup(spec); break; case ROUTE_REGEX: @@ -315,6 +320,7 @@ config_finish(struct gmnisrv_config *conf) while (route) { switch (route->routing) { case ROUTE_PATH: + case ROUTE_EXACT: free(route->path); break; case ROUTE_REGEX: -- cgit v1.2.3