@@ -94,7 +94,7 @@ int main() {
9494if (err == HPE_OK) { 
9595fprintf(stdout, "Successfully parsed!\n"); 
9696} else { 
97- fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), parser.reason ); 
97+ fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), llhttp_get_error_reason(& parser) ); 
9898} 
9999}
100100``` 
@@ -112,6 +112,7 @@ The following callbacks can return `0` (proceed normally), `-1` (error) or `HPE_
112112* `on_message_complete`: Invoked when a request/response has been completedly parsed. 
113113* `on_url_complete`: Invoked after the URL has been parsed. 
114114* `on_method_complete`: Invoked after the HTTP method has been parsed. 
115+ * `on_protocol_complete`: Invoked after the HTTP version has been parsed. 
115116* `on_version_complete`: Invoked after the HTTP version has been parsed. 
116117* `on_status_complete`: Invoked after the status code has been parsed. 
117118* `on_header_field_complete`: Invoked after a header name has been parsed. 
@@ -130,6 +131,7 @@ The following callbacks can return `0` (proceed normally), `-1` (error) or `HPE_
130131* `on_method`: Invoked when another character of the method is received.  
131132 When parser is created with `HTTP_BOTH` and the input is a response, this also invoked for the sequence `HTTP/` 
132133 of the first message. 
134+ * `on_protocol`: Invoked when another character of the protocol is received. 
133135* `on_version`: Invoked when another character of the version is received. 
134136* `on_header_field`: Invoked when another character of a header name is received. 
135137* `on_header_value`: Invoked when another character of a header value is received. 
@@ -187,7 +189,8 @@ Parse full or partial request/response, invoking user callbacks along the way.
187189
188190If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing interrupts,  
189191and such errno is returned from `llhttp_execute()`. If `HPE_PAUSED` was used as a errno,  
190- the execution can be resumed with `llhttp_resume()` call. 
192+ the execution can be resumed with `llhttp_resume()` call. In that case the input should be advanced  
193+ to the last processed byte from the parser, which can be obtained via `llhttp_get_error_pos()`. 
191194
192195In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE` is returned  
193196after fully parsing the request/response. If the user wishes to continue parsing,  
@@ -196,6 +199,8 @@ they need to invoke `llhttp_resume_after_upgrade()`.
196199**if this function ever returns a non-pause type error, it will continue to return  
197200the same error upon each successive call up until `llhttp_init()` is called.** 
198201
202+ If this function returns `HPE_OK`, it means all the input has been consumed and parsed. 
203+ 
199204### `llhttp_errno_t llhttp_finish(llhttp_t* parser)` 
200205
201206This method should be called when the other side has no further bytes to 
0 commit comments