summaryrefslogtreecommitdiffstats
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2019-05-13 15:19:16 +0000
committerreyk <reyk@openbsd.org>2019-05-13 15:19:16 +0000
commit2c58e08794aede29204d41f99a1f898148b6a0f1 (patch)
tree0de68a74dee603a4f429c21a17925a726e03d757 /usr.sbin/relayd
parentexplicitly mention that RES_NOALIASES has no effect; (diff)
downloadwireguard-openbsd-2c58e08794aede29204d41f99a1f898148b6a0f1.tar.xz
wireguard-openbsd-2c58e08794aede29204d41f99a1f898148b6a0f1.zip
Add Connection: close when switching to "unlimited" reading mode.
Ask the server to close the connection after the request since we don't read any further request headers. This fixes an issue with OPTIONS and optional body, as well as similar cases. Reported and tested by Rivo Nurges OK benno@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/relay_http.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c
index 82ed343e48d..e0ddadee46d 100644
--- a/usr.sbin/relayd/relay_http.c
+++ b/usr.sbin/relayd/relay_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_http.c,v 1.75 2019/05/13 09:54:07 reyk Exp $ */
+/* $OpenBSD: relay_http.c,v 1.76 2019/05/13 15:19:16 reyk Exp $ */
/*
* Copyright (c) 2006 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -522,6 +522,15 @@ relay_read_http(struct bufferevent *bev, void *arg)
bev->readcb = relay_read_httpchunks;
}
+ /*
+ * Ask the server to close the connection after this request
+ * since we don't read any further request headers.
+ */
+ if (cre->toread == TOREAD_UNLIMITED)
+ if (kv_add(&desc->http_headers, "Connection",
+ "close", 0) == NULL)
+ goto fail;
+
if (cre->dir == RELAY_DIR_REQUEST) {
if (relay_writerequest_http(cre->dst, cre) == -1)
goto fail;