commit 3bb8dcd1a8126baf8b9c731485fb2d664df1dd15 from: Omar Polo date: Mon Jul 08 20:06:02 2024 UTC s/should_buffer/proxy_proto commit - a0ec9cd6ce94b26faa1ab2f4407e6b0d0d43045d commit + 3bb8dcd1a8126baf8b9c731485fb2d664df1dd15 blob - c6cdf5586d0d1fdfafc4b4d381167e34885c01d4 blob + 2dc1ba1a4ad402a7f7a459602bc3f051fb3584a4 --- gmid.h +++ gmid.h @@ -309,7 +309,7 @@ struct buflayer { struct client { struct conf *conf; struct address *addr; - int should_buffer; + int proxy_proto; struct buflayer buf; uint32_t id; struct tls *ctx; blob - 69f358ab46252a0749527eb12dc3766f69ba9575 blob + a8d1f067baf2a7644d67f1cbcbdac23ad7e6effd --- server.c +++ server.c @@ -1299,7 +1299,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi { struct client *c = cb_arg; - if (!c->should_buffer) { + if (!c->proxy_proto) { /* no buffer to cache into, read into libtls buffer */ errno = 0; ssize_t ret = read(c->fd, buf, buflen); @@ -1318,7 +1318,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi c->buf.read_pos += copy_len; if (left == copy_len) { - c->should_buffer = 0; + c->proxy_proto = 0; c->buf.has_tail = 0; } @@ -1373,7 +1373,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi c->buf.has_tail = 1; } else { /* we consumed the whole buffer */ - c->should_buffer = c->buf.read_pos = 0; + c->proxy_proto = c->buf.read_pos = 0; c->buf.has_tail = 0; } @@ -1422,7 +1422,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; + c->proxy_proto = addr->proxy; e = getnameinfo(sraddr, len, c->rhost, sizeof(c->rhost), c->rserv, sizeof(c->rserv), NI_NUMERICHOST | NI_NUMERICSERV);