diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-01-31 12:20:06 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-01-31 12:20:06 +0000 |
commit | a185b0c443017bef2bcba1c01c717cf3d74c67c8 (patch) | |
tree | ca44b05beda89d86fffdf330354c380b82ffa148 /usr.sbin | |
parent | 6de464be544ce1b73113b5a5caa0e9d577b001ea (diff) |
Do not set EVBUFFER_EOF on read/write errors and handle EOF correctly.
Either libevent or the TLS callback can trigger an EOF when the
connection is closed.
OK sunil@ jung@ benno@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c index 9afc7c179fa..b6a8b550a97 100644 --- a/usr.sbin/httpd/server.c +++ b/usr.sbin/httpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.101 2017/01/09 14:49:22 reyk Exp $ */ +/* $OpenBSD: server.c,v 1.102 2017/01/31 12:20:05 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -861,7 +861,7 @@ server_write(struct bufferevent *bev, void *arg) return; done: - (*bev->errorcb)(bev, EVBUFFER_WRITE|EVBUFFER_EOF, bev->cbarg); + (*bev->errorcb)(bev, EVBUFFER_WRITE, bev->cbarg); return; } @@ -906,7 +906,7 @@ server_read(struct bufferevent *bev, void *arg) return; done: - (*bev->errorcb)(bev, EVBUFFER_READ|EVBUFFER_EOF, bev->cbarg); + (*bev->errorcb)(bev, EVBUFFER_READ, bev->cbarg); return; fail: server_close(clt, strerror(errno)); @@ -930,7 +930,11 @@ server_error(struct bufferevent *bev, short error, void *arg) server_close(clt, "buffer event error"); return; } - if (error & (EVBUFFER_READ|EVBUFFER_WRITE|EVBUFFER_EOF)) { + if (error & EVBUFFER_EOF) { + server_close(clt, "closed"); + return; + } + if (error & (EVBUFFER_READ|EVBUFFER_WRITE)) { bufferevent_disable(bev, EV_READ|EV_WRITE); clt->clt_done = 1; |