summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-10-19 00:13:22 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-10-19 00:31:19 +0200
commit87276b730d88124f9dd990e76d92e2b0499ac808 (patch)
tree3e62f6d2d1c9e92eb234f28194a9b9f9e145f56c /src
parente7c74917191a4953d495295b65732aa3549ba753 (diff)
http: Respect Connection: close from client
Diffstat (limited to 'src')
-rw-r--r--src/http.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/http.cc b/src/http.cc
index 21de28d..c88aa6d 100644
--- a/src/http.cc
+++ b/src/http.cc
@@ -794,6 +794,12 @@ class ServerImpl : public Server {
}
client.resp = delegate_.handle(request);
client.in->consume(end + 4);
+ // If client requests close, do so.
+ if (request.header_contains("connection", "close")) {
+ if (shutdown(client.fd.get(), SHUT_RD) == 0) {
+ client.read_closed_ = true;
+ }
+ }
return true;
}