Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for request body parsing #59

Open
lmarz opened this issue Dec 8, 2019 · 1 comment
Open

Support for request body parsing #59

lmarz opened this issue Dec 8, 2019 · 1 comment

Comments

@lmarz
Copy link

lmarz commented Dec 8, 2019

As far as I can see, phr_parse_request has the ability to parse the request headers (+method, url and http version), but not the body, which is essential for POST-requests. It would be really nice, if the parser has an option to extract and return the body

@mrakh
Copy link

mrakh commented Apr 18, 2020

I know it's 4 months late, but for future reference, the header list is terminated by an empty line, i.e. a CRLF immediately after the last header line's trailing CRLF. That's how phr_parse_request knows when to terminate. The request body should begin immediately after the empty line. So you should be able to get a pointer to the request body by doing [buffer start address] + [return value of phr_parse_request]. And you can derive the body length from the Content-Length header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants