Hi, Thanks for this project!
Sometimes servers send responses without Content-Length and expect the client to consume input (for the body) until EOF. Basically renders recv to return 0 before the parser decides the stream is complete, which will result in an error.
int ndata = recv(conn, buffer, sizeof(buffer), 0);
if (ndata <= 0) {
fprintf(stderr, "Error receiving data\n");
http_free(&rt);
close(conn);
return -1;
}
I wonder if this would be resolved by simply return 0 from http_data is the third parameter is passed as 0, i.e. EOF.