aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-08-24 09:13:52 +0000
committerOmar Polo <op@omarpolo.com>2024-08-24 09:13:52 +0000
commit07893552478cb648ca4ebac64885a27719c437b3 (patch)
tree176a0e9a8c0cbc53c74d892dc1d9790dc6c9aaf1
parent2fb3a49b7dbf5c701a36501de3b8fd7173b10912 (diff)
no need for the match_host dance
-rw-r--r--server.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/server.c b/server.c
index 4595ece..99467c0 100644
--- a/server.c
+++ b/server.c
@@ -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)",