summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-10-14 11:07:08 +0000
committerflorian <florian@openbsd.org>2019-10-14 11:07:08 +0000
commit4995d90a4ad1f4cf4f97fe1994d7462e16478218 (patch)
treeabe4e1f22ed895c4a6d867157d40d2d1df92adf2 /usr.sbin/httpd
parentDo not crash with pane_current_command if the pane is newly created and (diff)
downloadwireguard-openbsd-4995d90a4ad1f4cf4f97fe1994d7462e16478218.tar.xz
wireguard-openbsd-4995d90a4ad1f4cf4f97fe1994d7462e16478218.zip
httpd(8) sent a 408 response every time a connection request timeout
was reached. This is not what other servers are doing, it leads to ugly log messages and might confuse some clients. benno@ analyzed that the correct behavior is (probably) to send a 408 when we are in the middle of receiving headers and time out there and just close the connection in all other cases. In particular, if a connection gets opened and no request is received at all just close the connection. If a connection is set to keep-alive and a request was handled and no further request is coming in just close the connection. The later is the usual cause for spurious log messages and client confusion. Reported over the years by many. Input, explanations and OK benno
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/server.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index 577c9c7150e..a16b5181117 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.119 2019/06/28 13:32:47 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.120 2019/10/14 11:07:08 florian Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1036,7 +1036,10 @@ server_error(struct bufferevent *bev, short error, void *arg)
struct evbuffer *dst;
if (error & EVBUFFER_TIMEOUT) {
- server_abort_http(clt, 408, "timeout");
+ if (!clt->clt_headersdone && clt->clt_line > 0)
+ server_abort_http(clt, 408, "timeout");
+ else
+ server_close(clt, "timeout");
return;
}
if (error & EVBUFFER_ERROR) {