Open ashtum opened 2 months ago
You should show the smallest possible example code which uses the parser to extract two complete messages which are already stuffed into its input buffer
You should show the smallest possible example code which uses the parser to extract two complete messages which are already stuffed into its input buffer
I've added the example to the first comment.
If two or more HTTP responses are read into the
parser
buffer, and theparser::prepare()
buffer returns a non-empty mutable buffer, then the subsequentasync_read_some
operation on the stream will block indefinitely, assuming all responses have already been delivered. For example:This happens because the leftover data in the buffer isn't fully parsed when
parser::prepare()
is called. As a result, we can't determine if the buffer contains a complete or a partial message. To prevent indefinite blocking, we should assume that any leftover data after parsing a message might indicate a complete message. Therefore, we should avoid initiating another read attempt if leftovers are present.The flow would be as follows: