summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorRené Wagner <rwagner@rw-net.de>2021-01-27 20:57:18 +0100
committerDrew DeVault <sir@cmpwn.com>2021-01-29 08:55:43 -0500
commit32913c35cd5f36b00056d3e239c0e85f1f0ed000 (patch)
tree19088b68a894439f8d6dc0dd480c8dbdf9210a7c /src/config.c
parentea360fa4c10791c3c720c33470c86923424348fe (diff)
downloadgmnisrv-32913c35cd5f36b00056d3e239c0e85f1f0ed000.tar.gz
gmnisrv-32913c35cd5f36b00056d3e239c0e85f1f0ed000.tar.xz
gmnisrv-32913c35cd5f36b00056d3e239c0e85f1f0ed000.zip
implement handling of ROUTE_EXACT definitions
This patchset implements the handling of exact routes as described in gmnisrvini(5).
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c8
1 files changed, 7 insertions, 1 deletions
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 = &section[hostln + 1];
+ break;
case ':':
routing = ROUTE_PATH;
spec = &section[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: