Add Keep-Alive header to response
This commit is contained in:
parent
d26ee03613
commit
15ed1b4883
@ -1560,11 +1560,15 @@ inline void Server::write_response(Stream& strm, bool last_connection, const Req
|
|||||||
|
|
||||||
// Headers
|
// Headers
|
||||||
if (last_connection ||
|
if (last_connection ||
|
||||||
req.version == "HTTP/1.0" ||
|
|
||||||
req.get_header_value("Connection") == "close") {
|
req.get_header_value("Connection") == "close") {
|
||||||
res.set_header("Connection", "close");
|
res.set_header("Connection", "close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!last_connection &&
|
||||||
|
req.get_header_value("Connection") == "Keep-Alive") {
|
||||||
|
res.set_header("Connection", "Keep-Alive");
|
||||||
|
}
|
||||||
|
|
||||||
if (!res.body.empty()) {
|
if (!res.body.empty()) {
|
||||||
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
||||||
// TODO: 'Accpet-Encoding' has gzip, not gzip;q=0
|
// TODO: 'Accpet-Encoding' has gzip, not gzip;q=0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user