aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-01-02 16:33:28 +0000
committerOmar Polo <op@omarpolo.com>2022-01-02 16:33:28 +0000
commitb7967bc1f695126e1bf2705bfd486bbc32aaf8b0 (patch)
treed24f103eb78223a61049bfcebedb1686bd628c3c /gmid.c
parente2f167afb3444d3ba55fdffe234ef7812cac72f0 (diff)
proxy: allow multiple proxy blocks, matching options and validations
as a side effect the order of the content of a server block is relaxed: options, location or proxy blocks can be put in any order.
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gmid.c b/gmid.c
index a6e0d1b..2abdce0 100644
--- a/gmid.c
+++ b/gmid.c
@@ -279,6 +279,7 @@ free_config(void)
{
struct vhost *h, *th;
struct location *l, *tl;
+ struct proxy *p, *tp;
struct envlist *e, *te;
struct alist *a, *ta;
int v, i;
@@ -331,6 +332,17 @@ free_config(void)
free(a);
}
+ TAILQ_FOREACH_SAFE(p, &h->proxies, proxies, tp) {
+ TAILQ_REMOVE(&h->proxies, p, proxies);
+
+ free(p->match_proto);
+ free(p->match_host);
+ free(p->host);
+ tls_unload_file(p->cert, p->certlen);
+ tls_unload_file(p->key, p->keylen);
+ free(p);
+ }
+
free((char*)h->domain);
free((char*)h->cert);
free((char*)h->key);
@@ -338,10 +350,6 @@ free_config(void)
free((char*)h->cgi);
free((char*)h->entrypoint);
- free(h->proxy.host);
- tls_unload_file(h->proxy.cert, h->proxy.certlen);
- tls_unload_file(h->proxy.key, h->proxy.keylen);
-
TAILQ_REMOVE(&hosts, h, vhosts);
free(h);
}