This patch was authored and released by @tanner0101.
Adds support for gracefully shutting down in-flight requests and idle keep-alive connections (#2472, fixes #2451).
- In-flight requests will no longer respect
connection: keep-alive
after server shutdown is initiated. - Idle keep-alive connections will now be closed once server shutdown is initiated.
- Adds new
HTTPHeaders
helper for working withconnection
header.
// Change to 'connection: close'.
if req.headers.connection == .keepAlive {
req.headers.connection = .close
}