I am writing a server that uses select function to read from a set of sockets. Then I need to parse the received data as HTTP request. I find some C library from github such as PicoHTTPParser and nodejs/http-parser that may do the job but wonder if libcurl has such function, basically something like below.
// sock: a readable socket from select
r = read(sock, buf + buflen, sizeof(buf) - buflen));
if (r >= 0)
{
prevbuflen = buflen;
buflen += rret;
curl_parse_request(parser_object, buf, buflen, prevbuflen, ...);
// check parser_object to see if parsing is completed or not
// if so, parser_object contains head fields and body etc.
}