At line 174 of Messages.cpp, you detect errors by checking if (used < size). However, if you call http_parser_execute with size of 0 (indicating EOF) it returns 1 to indicate an error (i.e., used > size). The check employed in the http_parser documentation is (used != size) for this reason.