AndreLouisCaron/httpxx — Issue #5: http_parser_pause causes feed to return wrong read count
Author: pezcode
Created: 2012-02-24 22:29:10+00:00
State: open

This is kinda weird and I don't know if it's a bug in http-parser or in the usage of http_parser_pause in httpxx.

I call rev(MSG_PEEK) which reads, say, 300 bytes. Request::feed returns 299 bytes read, although the header is really 300 bytes long (I doublechecked). The complete flags are both set (it has no body).
As a result, I recv 299 bytes (to remove the header from the TCP buffer), but that's one byte to few. In my next loop (thinking this is a pipelined request), I call recv which blocks and at some point returns with no data read if the connection was closed.

PS: I temporarily used the newest commit of http-parser but the bug is the same.

(Only noticed this now after adding tons of error checking. What looked like a slow connection was a timed out select because of the missing byte. I know I'm a terrible bug reporter lol)