diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-10-02 19:22:44 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-10-02 19:22:44 +0000 |
commit | 309e5c1dad6b51d87abfae1eb916b48b04cb03a5 (patch) | |
tree | 9eef37f37801d13a3631cd2bd1ee8e1bff7bdc78 /usr.sbin | |
parent | cc393b477e7563cd66f3623f41a5018f213a2660 (diff) |
Fix an error case that was never handled ending up in an endless event
loop that could eat all CPU. I thought that the previous (correct)
commit fixed it which wasn't the case. But this one is obvious.
ok florian@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/server.c | 16 | ||||
-rw-r--r-- | usr.sbin/httpd/server_file.c | 16 |
2 files changed, 20 insertions, 12 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c index e756abb99f9..945ca45fd15 100644 --- a/usr.sbin/httpd/server.c +++ b/usr.sbin/httpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.42 2014/09/05 10:04:20 reyk Exp $ */ +/* $OpenBSD: server.c,v 1.43 2014/10/02 19:22:43 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -771,6 +771,14 @@ server_error(struct bufferevent *bev, short error, void *arg) server_close(clt, "buffer event timeout"); return; } + if (error & EVBUFFER_ERROR) { + if (errno == EFBIG) { + bufferevent_enable(bev, EV_READ); + return; + } + server_close(clt, "buffer event error"); + return; + } if (error & (EVBUFFER_READ|EVBUFFER_WRITE|EVBUFFER_EOF)) { bufferevent_disable(bev, EV_READ|EV_WRITE); @@ -786,11 +794,7 @@ server_error(struct bufferevent *bev, short error, void *arg) server_close(clt, "done"); return; } - if (error & EVBUFFER_ERROR && errno == EFBIG) { - bufferevent_enable(bev, EV_READ); - return; - } - server_close(clt, "buffer event error"); + server_close(clt, "unknown event error"); return; } diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index 10fbf4c1bd1..ef337e7ccb1 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.36 2014/09/27 12:49:45 reyk Exp $ */ +/* $OpenBSD: server_file.c,v 1.37 2014/10/02 19:22:43 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -422,6 +422,14 @@ server_file_error(struct bufferevent *bev, short error, void *arg) server_close(clt, "buffer event timeout"); return; } + if (error & EVBUFFER_ERROR) { + if (errno == EFBIG) { + bufferevent_enable(bev, EV_READ); + return; + } + server_close(clt, "buffer event error"); + return; + } if (error & (EVBUFFER_READ|EVBUFFER_WRITE|EVBUFFER_EOF)) { bufferevent_disable(bev, EV_READ|EV_WRITE); @@ -448,10 +456,6 @@ server_file_error(struct bufferevent *bev, short error, void *arg) server_close(clt, "done"); return; } - if (error & EVBUFFER_ERROR && errno == EFBIG) { - bufferevent_enable(bev, EV_READ); - return; - } - server_close(clt, "buffer event error"); + server_close(clt, "unknown event error"); return; } |