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 was archived by the owner on Nov 6, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 6, 2022. It is now read-only.
I can end parsing a message by returning some non-0 value. So if the parsing failed, I would like to see why it failed, hence, look at the return (error) code.
Please provide something like a error_code member in the http_parser struct.
yes, but it exits immediately if there was an error. so if http_parser_execute() < sizeof(buf) then there was an error (or an Upgrade). You can use this to point out where the error was - which is perhaps more useful than an error code.
hrm, I'd like to use the return values for indicating the reason why I made http-parser exit; for example after I got the request URL and figured out I want to answer with HTTP 404, it would be comfortable to simply return 404.
If I manually break parsing, I've got a reason to and I most probably want to communicate that reason back to the code that called http_parser_execute so that code can decide what steps to take next.
Activity
ry commentedon Apr 26, 2010
you can see where it failed by looking at the result of http_parser_execute()
jonashaag commentedon Apr 26, 2010
wtf, that was fast. Doesn't
http_parser_executereturn the number of bytes parsed?ry commentedon Apr 26, 2010
yes, but it exits immediately if there was an error. so if http_parser_execute() < sizeof(buf) then there was an error (or an Upgrade). You can use this to point out where the error was - which is perhaps more useful than an error code.
jonashaag commentedon Apr 26, 2010
hrm, I'd like to use the return values for indicating the reason why I made http-parser exit; for example after I got the request URL and figured out I want to answer with HTTP 404, it would be comfortable to simply return
404.If I manually break parsing, I've got a reason to and I most probably want to communicate that reason back to the code that called
http_parser_executeso that code can decide what steps to take next.So please add this feature. :-)
ry commentedon Apr 26, 2010
You can communicate your state (or what action to take) to the code calling
http_parser_execute()through yourvoid *dataobject.ry commentedon Jun 6, 2010
closing.