summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2018-10-11 09:52:22 +0000
committerbenno <benno@openbsd.org>2018-10-11 09:52:22 +0000
commit833d1df9c059cb7e42fa8c29ed39fd8ac73f9927 (patch)
tree766725c964fd3053e22f5230533385f7a6a78d9f /usr.sbin/httpd
parentdon't send new-style rsa-sha2-*-cert-v01@openssh.com names to older (diff)
downloadwireguard-openbsd-833d1df9c059cb7e42fa8c29ed39fd8ac73f9927.tar.xz
wireguard-openbsd-833d1df9c059cb7e42fa8c29ed39fd8ac73f9927.zip
Backout my previous commit:
date: 2018/10/01 19:24:09; author: benno; state: Exp; lines: +7 -1; commitid: 0O8fyHPNvPd8rvYU; Only send 408 Timeout responses when we have seen at least part of a request. Without a request, just close the connection when we hit request timeout. Prompted by a bug report from Nikola Kolev, thanks. ok reyk@ and some suggestions from claudio@ and bluhm@ Mark Patruck (mark AT wrapped DOT cx) found a problem with it, thanks for the report. ok reyk@ bluhm@ sthen@ deraadt@
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/httpd.h11
-rw-r--r--usr.sbin/httpd/server.c8
-rw-r--r--usr.sbin/httpd/server_http.c8
3 files changed, 9 insertions, 18 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index 67cb45e138d..3d150a53ac9 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.141 2018/10/01 19:24:09 benno Exp $ */
+/* $OpenBSD: httpd.h,v 1.142 2018/10/11 09:52:22 benno Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -100,11 +100,10 @@
enum httpchunk {
TOREAD_UNLIMITED = -1,
- TOREAD_HTTP_INIT = -2,
- TOREAD_HTTP_HEADER = -3,
- TOREAD_HTTP_CHUNK_LENGTH = -4,
- TOREAD_HTTP_CHUNK_TRAILER = -5,
- TOREAD_HTTP_NONE = -6,
+ TOREAD_HTTP_HEADER = -2,
+ TOREAD_HTTP_CHUNK_LENGTH = -3,
+ TOREAD_HTTP_CHUNK_TRAILER = -4,
+ TOREAD_HTTP_NONE = -5,
TOREAD_HTTP_RANGE = TOREAD_HTTP_CHUNK_LENGTH
};
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index ef4aa6a2a93..63536a060e2 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.115 2018/10/01 19:24:09 benno Exp $ */
+/* $OpenBSD: server.c,v 1.116 2018/10/11 09:52:22 benno Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -901,6 +901,7 @@ server_input(struct client *clt)
return;
}
+ clt->clt_toread = TOREAD_HTTP_HEADER;
inrd = server_read_http;
slen = sizeof(clt->clt_sndbufsiz);
@@ -1018,10 +1019,7 @@ server_error(struct bufferevent *bev, short error, void *arg)
struct evbuffer *dst;
if (error & EVBUFFER_TIMEOUT) {
- if (clt->clt_toread != TOREAD_HTTP_INIT)
- server_abort_http(clt, 408, "timeout");
- else
- server_abort_http(clt, 0, "timeout");
+ server_abort_http(clt, 408, "timeout");
return;
}
if (error & EVBUFFER_ERROR) {
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
index c61e4128bf1..bc0f754e0aa 100644
--- a/usr.sbin/httpd/server_http.c
+++ b/usr.sbin/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.124 2018/10/01 19:24:09 benno Exp $ */
+/* $OpenBSD: server_http.c,v 1.125 2018/10/11 09:52:22 benno Exp $ */
/*
* Copyright (c) 2006 - 2018 Reyk Floeter <reyk@openbsd.org>
@@ -88,7 +88,6 @@ server_httpdesc_init(struct client *clt)
}
RB_INIT(&desc->http_headers);
clt->clt_descresp = desc;
- clt->clt_toread = TOREAD_HTTP_INIT;
return (0);
}
@@ -212,10 +211,6 @@ server_read_http(struct bufferevent *bev, void *arg)
size = EVBUFFER_LENGTH(src);
DPRINTF("%s: session %d: size %lu, to read %lld",
__func__, clt->clt_id, size, clt->clt_toread);
-
- if (clt->clt_toread == TOREAD_HTTP_INIT)
- clt->clt_toread = TOREAD_HTTP_HEADER;
-
if (!size) {
clt->clt_toread = TOREAD_HTTP_HEADER;
goto done;
@@ -739,7 +734,6 @@ server_reset_http(struct client *clt)
server_httpdesc_free(clt->clt_descresp);
clt->clt_headerlen = 0;
clt->clt_headersdone = 0;
- clt->clt_toread = TOREAD_HTTP_INIT;
clt->clt_done = 0;
clt->clt_line = 0;
clt->clt_chunk = 0;