aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-01-05 18:58:01 +0000
committerOmar Polo <op@omarpolo.com>2022-01-05 18:58:01 +0000
commit901905e0cf0f5f141461df7ea199711ea951c919 (patch)
tree44b419e53190319c4e0d48d9f5a006bd1656dda0 /server.c
parent876a417023a6a38cc61f61bf3083305455a7f8ec (diff)
bail out of client_read if we've already decide what to do
libevent2 can still somehowe call client_read even in code paths that never enable reading from the evbuffer. Can't reproduce on the libevent in base on OpenBSD. It's a bit ugly, but it's a small workaround for something that otherwise *always* make gmid crash when linked against libevent2. (client_read works under the assumption that c->host != NULL, matched_proxy crashes otherwise.)
Diffstat (limited to 'server.c')
-rw-r--r--server.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/server.c b/server.c
index cd994fb..2f5912c 100644
--- a/server.c
+++ b/server.c
@@ -1004,6 +1004,14 @@ client_read(struct bufferevent *bev, void *d)
bufferevent_disable(bev, EVBUFFER_READ);
+ /*
+ * libevent2 can still somehow call this function, even
+ * though I never enable EV_READ in the bufferevent. If
+ * that's the case, bail out.
+ */
+ if (c->type != REQUEST_UNDECIDED)
+ return;
+
/* max url len + \r\n */
if (EVBUFFER_LENGTH(src) > 1024 + 2) {
log_err(c, "too much data received");