0

So recently I have been trying to implement my own simple web server but then I got into this big dilemma on to which http parser I wanted to use. I finally found two good http parsers llhttp used in nodejs and the pico http parser, but both seem to not satisfy my requirements. The issue with llhttp parser was that it needs the complete request to parse, rather I want to read the headers and based on what the Content-Length is I would like to read the body. On the other hand in pico http parser I had to allocate memory beforehand for my headers,which makes sense since it doesn't use callbacks of any sort but lets you take in incomplete request or lazily load the body cause it takes pointers to the request and request length. I am really looking for a http parser which can overcame both these issues, I honestly can't find one, but this brings me to dilemma if lazily loading a body really practical or is it more practical to just read the bytes from a TCP connection until EOF is reached and then parse it? Really would appreciate any help in this regard. Thanks!

1
  • Welcome Bad_Panda! If you break up your question into smaller paragraphs, it will improve the readability, which may result in answers! Apr 22 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.