HTTP/1.1 default keep-alive to avoid TIME_WAIT
@@ -134,7 +134,7 @@ handle_request:
}
res->headers["Server"] = s_Server;
// Connection:
- bool keepalive = false;
+ bool keepalive = true;
auto iter_keepalive = req->headers.find("connection");
if (iter_keepalive != req->headers.end()) {
if (stricmp(iter_keepalive->second.c_str(), "keep-alive") == 0) {
@@ -144,6 +144,9 @@ handle_request:
keepalive = false;
}
}
+ else if (req->http_major == 1 && req->http_minor == 0) {
+ keepalive = false;
+ }
if (keepalive) {
res->headers["Connection"] = "keep-alive";
}
