You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.
I've managed to read the body of the message by saving the number of bytes read in the callback on_headers_complete(). It was my misunderstanding of how the code works.
http_parser_execute() parsed the entire buffer you passed it, including the body. The body was passed to the on_body callback. After the entire http message was parsed, it reset to initial state to be ready to parse another message.
Was content_length available in on_message_complete callback? As @ploxiln said, the parser resets its state to initial to prepare for the next message.
Hello! I am trying to parse the following message:
HTTP/1.1 200 OK
Server: Cowboy
Date: Fri, 15 Jun 2018 10:30:14 GMT
Content-Type: application/json
Content-Length: 18
Via: 1.1 vegur
Expires: Fri, 15 Jun 2018 12:30:14 GMT
Connection: keep-alive
{"hello": "world"}
It returns content_length = 0. It only works if I add "Transfer-Encoding: chunked". This is my code:
Is this a bug? Or have I misconfigured something?
The text was updated successfully, but these errors were encountered: