Skip to content

Honor set_decompress(false) in response streams - #2640

Merged
yhirose merged 2 commits into
yhirose:masterfrom
harbinresearcher:codex/fix-stream-decompression-option
Oct 26, 2026
Merged

yhirose merged 2 commits into
yhirose:masterfrom
harbinresearcher:codex/fix-stream-decompression-option

Conversation

@harbinresearcher

Copy link
Copy Markdown
Contributor

set_decompress(false) preserves encoded bytes with Get(), but open_stream() currently ignores the option. Without zlib support a gzip response fails with UnsupportedContentEncoding; with zlib it succeeds but returns decoded text. stream::Get() inherits both behaviors.

Honor the existing decompress_ flag before creating the streaming decoder. Keep the default decoding and unsupported-coding errors unchanged. No API, decoder algorithm, or dependency changes.

The regression uses the existing fixed gzip fixture and real loopback responses. It checks buffered, low-level streaming, and stream::Get() results for Content-Length, chunked, and close-delimited bodies, including byte preservation, encoding headers, and read errors. It fails on the original header in both no-codec and zlib-enabled builds, with six streaming failures in each; buffered controls pass.

Validation on Windows amd64, GCC 14.2, C++11:

  • Focused tests: 26/26 without optional codecs, 33/33 with zlib.
  • Broad offline runs: 791/791 passed without optional codecs. With zlib, 838/840 passed; the two failures, WebSocketPreRoutingTest.RejectWithoutAuth and WebSocketPreRequestTest.RejectWithoutAuth, also fail with the original header: both expect Content-Length 12 although the gzip response's length is 32. They are not changed here.
  • clang-format 23.1.3 and git diff --check pass; test-file UTF-8 BOM preserved.

The initial unmodified offline test run had two failures also reproduced with the original pre-fix binary: test/www/file was converted from LF to CRLF at checkout, and SSEIntegrationTest.MaxReconnectAttempts took about 12.4s against its 7s Windows threshold. The broad runs above use a private copy of test assets with that one fixture restored from the original Git blob, and exclude that existing timing test as well as the project's standard *_Online exclusion. The zlib run still has the two baseline failures described above, so this is not a claim of a fully green unfiltered suite. No test thresholds, source fixtures, Git settings, or system settings are changed by this PR. Local Linux, MSVC, TLS, Brotli, zstd, and sanitizers have not been validated.

Fixes #2639.

Disclosure: implemented and tested autonomously by an AI coding agent under the account owner's authorization. An independent AI reviewer performed a static read-only review with no findings; this is not a claim of human review or independent runtime verification.

@yhirose

yhirose commented Oct 23, 2026

Copy link
Copy Markdown
Owner

There are a bunch of errors on the CI checks...

…at the fix changes

The test called detail::from_i_to_hex, which the split build and MSVC do not
see, so every CI job failed to compile. The fix is one branch ahead of the
framing, so a single Content-Length body through open_stream() and
stream::Get() covers it; the chunked and close-delimited bodies and the
buffered control repeated what other tests already check.
@yhirose
yhirose merged commit 76f84a5 into yhirose:master Oct 26, 2026
27 of 28 checks passed
@yhirose

yhirose commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

open_stream ignores set_decompress(false)

2 participants