Skip to content

refactor!: own buffer_param and fix content encoding never finishing - #296

Merged
sgerbino merged 2 commits into
developfrom
pr/buffer-refactor
Oct 30, 2026
Merged

sgerbino merged 2 commits into
developfrom
pr/buffer-refactor

Conversation

@sgerbino

Copy link
Copy Markdown
Collaborator

Follows cppalliance/capy#479.

Capy removed buffer_param and buffer_slice and made consuming_buffers private.

  • Adds http::buffer_param / const_buffer_param, a copy of capy's, used by the type-erased sources and sinks, parser::read, and the content coding filter.
  • Replaces the parser's buffer_slice with buffer_copy's at_most argument.
  • Adopts capy's renamed buffer functions.

Bug fix: content encoding never finishing. The filter now skips empty input buffers. The serializer's final call passes two empty buffers, which used to count as more input, so the encoder never received finish and a gzip encoded message never completed. testGzipFinishes covers it and fails on the old code.

buffer_param exposes one window of buffers at a time, so the filter counts the remaining bytes itself and parser::read keeps copying until the body is drained (testReadManyBuffers).

Merge order: after cppalliance/capy#479. CI clones capy develop, so it cannot pass until that merges.

Capy removed buffer_param and buffer_slice and made consuming_buffers
private. Add http::buffer_param, a copy of capy's, and use it in the
type-erased sources and sinks, parser::read, and the content coding
filter. Replace the parser's buffer_slice with buffer_copy's at_most
argument, and adopt capy's renamed buffer functions.

The filter now skips empty input buffers. The serializer's final call
passes two empty buffers, which used to count as more input, so the
encoder never received finish and a gzip encoded message never
completed. buffer_param exposes one window of buffers at a time, so
the filter counts the remaining bytes itself and parser::read keeps
copying until the body is drained.

Add tests for gzip encoding and for reading into many buffers.
The deflate and inflate filters never called deflate_end or
inflate_end, so every gzip or deflate message leaked the zlib state.
The brotli filter already releases its encoder in its destructor.
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://296.http.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-10-30 22:01:50 UTC

@sgerbino
sgerbino merged commit 1f58e97 into develop Oct 30, 2026
24 checks passed
@sgerbino
sgerbino deleted the pr/buffer-refactor branch October 30, 2026 22:50
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants