If some payload data is received in the same buffer where you receive http headers, that payload is missed.
The way I found to permit this funxtion to work correctly also in this situation is to avoid the check if the buffer is at eof:
line 637 and following:
if(process_header == 0)
{
//if(req->buffer->at_eof) {
printf("***** BBB\n");
fill_buffer(req);
//}