From 063c26661185af07f1e2d45619db0af54efb9366 Mon Sep 17 00:00:00 2001 From: SeeWhy Date: Sat, 25 Jun 2022 11:40:29 +0800 Subject: [PATCH] fixbug: check IsKeepAlive before write (#207) --- http/server/HttpResponseWriter.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http/server/HttpResponseWriter.h b/http/server/HttpResponseWriter.h index e4362d5d0..1133f507f 100644 --- a/http/server/HttpResponseWriter.h +++ b/http/server/HttpResponseWriter.h @@ -133,6 +133,7 @@ class HttpResponseWriter : public SocketChannel { } int ret = 0; + bool keepAlive = response->IsKeepAlive(); if (state == SEND_CHUNKED) { if (buf) { ret = WriteChunked(buf, len); @@ -159,7 +160,7 @@ class HttpResponseWriter : public SocketChannel { } state = SEND_END; - if (!response->IsKeepAlive()) { + if (!keepAlive) { close(true); } return ret;