mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-17 19:30:54 +00:00
A kept-alive connection was reused while bytes that belong to no request were waiting on it, and the next request read them as its response. Such bytes are not a response (RFC 9112 9.2). A server may, for one, send a 408 before it closes an idle connection. Close the connection when they show up: after a response, if bytes past it are already buffered in the stream or the TLS library, and before reuse, if anything is readable on the socket. As in curl, the reuse check no longer asks the TLS library whether the peer closed, so it is the same for every TLS backend. A TLS message on an idle connection, such as a late session ticket, now costs a new connection.