-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Public API for starting in the headers-state #108
Comments
It's a reasonable request but I don't think it's possible to implement. Multipart body parts are separated by a boundary marker that http-parser would need to scan for. The parser doesn't backtrack so a partial false positive could lead to data being dropped, particularly if the message is spread out over several chunks. To illustrate:
The |
I'm not suggesting that http-parser would scan for boundaries. On the contrary; I want to scan for boundaries. I would create a new http-parser and only give it this:
|
Right, that would be fairly easy to implement but it doesn't seem like there's a need for it. Create a new parser, feed it a trivial |
Agreed; closing. |
Feeding it a status line is indeed a simple workaround, but a bit of a hacky solution. Would you accept a PR for this? |
@tdecaluwe I don't think that it is a good idea. Through recent years, we have refactored http-parser pretty significantly internally, and exposing these states will lock us into a particular API just for this use-case. Sorry, but won't fix. |
Multipart bodies are almost like a HTTP req/res; they just don't have status line:
It would be nice if it was possible parse these headers (the body would just appear as a streaming/EOF-detected body) using http-parser.
The text was updated successfully, but these errors were encountered: