mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-04 06:14:21 +07:00
A client may pipeline its requests (RFC 9112 9.3.2). The server read the following request(s) into a per-request SocketStream buffer, discarded them with the stream after the first response, and then waited in keep_alive() for socket data that never came, closing the connection after the keep-alive timeout. Over TLS the bytes stayed decrypted in the TLS library, where keep_alive() could not see them either. Create one stream per connection and serve a request that is already buffered (Stream::is_readable()) without waiting in keep_alive(). Keeping the buffer means an extra CRLF that some clients send after a request body is now parsed as the next request line, which answered 400 and closed the connection. Ignore one empty line before the request-line, as RFC 9112 2.2 recommends. Fixes #2599