Skip to content

Design document for the new parser #287

Description

@ashtum

The http parser in the burl project are improved versions of those in this project. We need a design document that explains the rationale behind each change.

The document should include (not limited to) changes like:

  • The per-message buffer compaction is gone. head_parser continues building the next header at a lower address inside the circular buffer, so pipelined messages no longer pay a memmove between messages.
  • The parser is now sans-I/O and public: a state machine that never suspends and never touches a stream, usable from any I/O model. Bodies can be retrieved without copying: pull hands out descriptors into the parser's own buffer, and commit_direct lets the stream read straight into caller-supplied memory, bypassing the parser's buffer entirely.
  • message_reader binds a stream to a parser and drives it, satisfying capy::ReadStream, http::ReadSource, and http::BufferSource over the message body. The client is rebuilt on top of it, so users driving the parser themselves get the exact same implementation the library uses.
  • The trailer fields of a chunked payload are now accessible: parse_trailer appends them, in the order received, to any fields container.
  • Body limit management is reduced to a single remaining-octets counter. Every body operation parses the header implicitly when it has not been parsed yet, and flatten_body de-chunks the body in place incrementally instead of requiring it complete up front.
  • The compression documentation is updated for the built-in decoders.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

  • Status
    Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions