Honor set_decompress(false) in response streams (#2640)

open_stream_() created a decoder whatever set_decompress() said, so a response stream decoded the body when decompression was disabled, and failed with UnsupportedContentEncoding in a build without that decoder. The buffered path already checks the option; the streaming path now does too. The new test covers open_stream() and stream::Get().

Fixes #2639.
This commit is contained in:
Luochenchen authored and GitHub committed 2026-10-25 20:05:56 -04:00
1 parent d23d1b6029
commit 76f84a5bfd
2 files changed
+32 -1

No files matched your search

+1 -1
View File
@@ -16020,7 +16020,7 @@ inline ClientImpl::StreamHandle ClientImpl::open_stream_(Request &req) {
auto content_encoding = detail::get_combined_header_value(
handle.response->headers, "Content-Encoding");
if (!content_encoding.empty()) {
if (decompress_ && !content_encoding.empty()) {
// Same policy as prepare_content_receiver(): reject a coding we know about
// but were not built with, pass an unrecognized one through as-is.
handle.decompressor_ = detail::create_decompressor(content_encoding);