Check if an IO error represents a benign connection close. TLS peers commonly close the socket without sending a `close_notify` alert. Rustls reports this as `UnexpectedEof`, but it's functionally equivalent to a clean close when no request data has been received yet.
(err: &std::io::Error)
| 2393 | /// Rustls reports this as `UnexpectedEof`, but it's functionally equivalent |
| 2394 | /// to a clean close when no request data has been received yet. |
| 2395 | fn is_benign_close(err: &std::io::Error) -> bool { |
| 2396 | matches!( |
| 2397 | err.kind(), |
| 2398 | std::io::ErrorKind::UnexpectedEof |
| 2399 | | std::io::ErrorKind::ConnectionReset |
| 2400 | | std::io::ErrorKind::BrokenPipe |
| 2401 | ) |
| 2402 | } |
| 2403 | |
| 2404 | #[cfg(test)] |
| 2405 | #[allow( |
no outgoing calls
no test coverage detected