Skip to content

Commit

Permalink
fixbug: check IsKeepAlive before write (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
seewhy-chen authored Jun 25, 2022
1 parent 4ddf20e commit 063c266
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion http/server/HttpResponseWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -159,7 +160,7 @@ class HttpResponseWriter : public SocketChannel {
}

state = SEND_END;
if (!response->IsKeepAlive()) {
if (!keepAlive) {
close(true);
}
return ret;
Expand Down

0 comments on commit 063c266

Please sign in to comment.