This repository has been archived by the owner on Nov 6, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - Add http_parser_pause() API. A callback may invoke this at any time. This will cause http_parser_parse() to return indicating that it parsed less than the number of requested bytes and set an error to HBE_PAUSED. A paused parser with fail with HBE_PAUSED until it is un-paused with http_parser_pause(). - Stop using 'state', 'header_state', 'index', and 'nread' shadow variables and then updating their http_parser fields when we're done. Instead, update the live values as we go. This will make it possible to return from anywhere in the parser (say, due to EPAUSED) and have valid/expected state. - Update state before making callbacks so that if the want to pause, we'll know the correct state already. - Make sure that every callback has a state that uniquely identifies the next step so that we can resume in the right place if we were suppoed to be paused. - Clean and re-factor up CALLBACK() macros. - Use CALLBACK() macros for (almost) all callbacks; on_headers_complete is still a special case. This includes on_body which we used to invoke manually with a long run of bytes. We now use a 'body' mark and hit its callback just like every other data callback. - Clean up (most) gotos and replace with real states. - Add some unit tests. Fixes #70
- Loading branch information