aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-06-17 20:47:24 +0000
committerOmar Polo <op@omarpolo.com>2024-06-17 20:47:24 +0000
commit94f143773948fe3bf811a9cd8c233198af58235b (patch)
tree2c6c7a4166ddc294c90a54c850d5056814853a2b /server.c
parentc46b7a0c11dee112af857732636e73ef20ccb5e7 (diff)
add a proxy-v1 keyword to enable the proxy protocol handling
Diffstat (limited to 'server.c')
-rw-r--r--server.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/server.c b/server.c
index c160301..525820c 100644
--- a/server.c
+++ b/server.c
@@ -1226,8 +1226,6 @@ client_close_ev(int fd, short event, void *d)
close(c->fd);
c->fd = -1;
- c->should_buffer = 0;
-
free(c);
}
@@ -1417,6 +1415,7 @@ server_accept(int sock, short et, void *d)
c->pfd = -1;
memcpy(&c->raddr, &raddr, sizeof(raddr));
c->raddrlen = len;
+ c->should_buffer = addr->proxy;
e = getnameinfo(sraddr, len, c->rhost, sizeof(c->rhost),
c->rserv, sizeof(c->rserv), NI_NUMERICHOST | NI_NUMERICSERV);
@@ -1427,8 +1426,6 @@ server_accept(int sock, short et, void *d)
return;
}
- c->should_buffer = 1; // TODO set if config has proto-v1 enabled
-
if (tls_accept_cbs(addr->ctx, &c->ctx, read_cb, write_cb, c) == -1) {
log_warnx("failed to accept socket: %s", tls_error(c->ctx));
close(c->fd);