seanmonstar / httparse

A push parser for the HTTP 1.x protocol in Rust.
https://docs.rs/httparse
Apache License 2.0
584 stars 114 forks source link

Returning more information on partial results and errors #162

Open tgnottingham opened 5 months ago

tgnottingham commented 5 months ago

There are a couple of changes I've implemented locally that enable getting more information from the parser on partial results and errors. Unfortunately, they're all breaking changes. I'm curious if they might be accepted in a later version of httparse, however unlikely that may be.

For context, my use case calls for an incremental parser -- that is, one that can resume parsing from the start of a header field, rather than having to restart from the beginning of the start line when a previous parse only gave a partial result. httparse enables this with its ability to return partial data, but there are some difficult spots.

The following changes would make things easier:

@seanmonstar, what do you think about this? Is there any chance these changes might be accepted in new major version? Or any chance the first two bullets would be accepted without increasing the major version number?