|
let mut found_keep_alive = false; |
|
if let Some(header) = response.headers.get("connection") { |
|
if header.eq_ignore_ascii_case("keep-alive") { |
|
found_keep_alive = true; |
|
} |
|
} |
|
if !found_keep_alive { |
|
conn.permits.store(0, Ordering::Release); |
|
conn.readable_request_id.store(usize::MAX, Ordering::Release); |
|
} else { |
|
conn.readable_request_id.fetch_add(1, Ordering::Release); |
HTTP/1.1 connections are persistent by default unless Connection: close is present. Servers such as Caddy therefore omit Connection: keep-alive. bitreq consequently marks a healthy socket unusable and performs a new TCP and TLS handshake for the next request.
Expected behavior:
- HTTP/1.1 or later: reuse unless
Connection: close is present.
- HTTP/1.0: require explicit
Connection: keep-alive.
RFC 9112 §9.3: https://www.rfc-editor.org/rfc/rfc9112.html#section-9.3
Related: #562
Will see to fix as part of #564.
corepc/bitreq/src/connection.rs
Lines 578 to 588 in 2d56a77
HTTP/1.1 connections are persistent by default unless
Connection: closeis present. Servers such as Caddy therefore omitConnection: keep-alive.bitreqconsequently marks a healthy socket unusable and performs a new TCP and TLS handshake for the next request.Expected behavior:
Connection: closeis present.Connection: keep-alive.RFC 9112 §9.3: https://www.rfc-editor.org/rfc/rfc9112.html#section-9.3
Related: #562
Will see to fix as part of #564.