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;