Skip to content

Commit 515206a

Browse files
authored
chore: Updated README. (#618)
1 parent c99725f commit 515206a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int main() {
9494
if (err == HPE_OK) {
9595
fprintf(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
```
@@ -189,7 +189,8 @@ Parse full or partial request/response, invoking user callbacks along the way.
189189
190190
If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing interrupts,
191191
and such errno is returned from `llhttp_execute()`. If `HPE_PAUSED` was used as a errno,
192-
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()`.
193194
194195
In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE` is returned
195196
after fully parsing the request/response. If the user wishes to continue parsing,
@@ -198,6 +199,8 @@ they need to invoke `llhttp_resume_after_upgrade()`.
198199
**if this function ever returns a non-pause type error, it will continue to return
199200
the same error upon each successive call up until `llhttp_init()` is called.**
200201
202+
If this function returns `HPE_OK`, it means all the input has been consumed and parsed.
203+
201204
### `llhttp_errno_t llhttp_finish(llhttp_t* parser)`
202205
203206
This method should be called when the other side has no further bytes to

0 commit comments

Comments
 (0)