mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
WebServer: Close the socket if Connection: keep-alive isn't requested
This commit is contained in:
parent
7ab4337721
commit
0e173da86f
1 changed files with 8 additions and 0 deletions
|
@ -203,6 +203,14 @@ ErrorOr<void> Client::send_response(InputStream& response, HTTP::HttpRequest con
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
|
auto keep_alive = false;
|
||||||
|
if (auto it = request.headers().find_if([](auto& header) { return header.name.equals_ignoring_case("Connection"); }); !it.is_end()) {
|
||||||
|
if (it->value.trim_whitespace().equals_ignoring_case("keep-alive"))
|
||||||
|
keep_alive = true;
|
||||||
|
}
|
||||||
|
if (!keep_alive)
|
||||||
|
m_socket->close();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue