diff options
author | Omar Polo <op@omarpolo.com> | 2024-08-24 09:13:52 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2024-08-24 09:13:52 +0000 |
commit | 07893552478cb648ca4ebac64885a27719c437b3 (patch) | |
tree | 176a0e9a8c0cbc53c74d892dc1d9790dc6c9aaf1 /server.c | |
parent | 2fb3a49b7dbf5c701a36501de3b8fd7173b10912 (diff) |
no need for the match_host dance
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 29 |
1 files changed, 8 insertions, 21 deletions
@@ -356,7 +356,6 @@ handle_handshake(int fd, short ev, void *d) { struct client *c = d; struct conf *conf = c->conf; - struct address *addr; struct vhost *h; const char *servname; const char *parse_err = "unknown error"; @@ -403,30 +402,18 @@ handle_handshake(int fd, short ev, void *d) return; } - TAILQ_FOREACH(h, &conf->hosts, vhosts) { - if (*c->domain == '\0') { - /* - * serialize the (matching) address if there's no - * SNI so that we can support requests for raw IPv6 - * address. - */ - TAILQ_FOREACH(addr, &h->addrs, addrs) - if (match_addr(addr, c->addr)) - break; - if (addr == NULL) - continue; - if (strlcpy(c->domain, addr->pp, sizeof(c->domain)) - >= sizeof(c->domain)) { - log_warnx("%s: domain too long: %s", __func__, - addr->pp); - *c->domain = '\0'; - break; - } + if (*c->domain == '\0') { + if (strlcpy(c->domain, c->addr->pp, sizeof(c->domain)) + >= sizeof(c->domain)) { + log_warnx("%s: domain too long: %s", __func__, + c->addr->pp); + *c->domain = '\0'; } + } + TAILQ_FOREACH(h, &conf->hosts, vhosts) if (match_host(h, c)) break; - } log_debug("handshake: SNI: \"%s\"; decoded: \"%s\"; matched: \"%s\"", servname != NULL ? servname : "(null)", |