fix(engine): treat Content-Encoding: none as no-op, not unsupported - #233
Merged
Conversation
Some servers/proxies send the non-standard but self-explanatory Content-Encoding: none to state that no compression was applied, instead of omitting the header or sending identity. unsupported_content_encoding() only whitelisted "identity" and "" as no-op tokens, so "none" fell into the unknown-encoding branch and every download from such a server was permanently refused (this failure is excluded from the retriable set by design, so retries could never recover it). Add "none" to the no-op whitelist in native/engine/src/downloader.rs::unsupported_content_encoding, used by both the single-stream (downloader.rs) and segmented (segment_coordinator.rs) download paths. detect_content_encoding already treated "none" as no-op (unknown tokens fall through to None there), so this fix aligns the two gates. Fixes #232
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repro
A server responds with the header
Content-Encoding: none(a non-standard but self-explanatory token some servers/proxies send to mean "no compression applied", instead of omitting the header or sendingidentity). Any download attempt against such a server — single-stream or segmented — fails with:server applied an unsupported or multi-layered response compression scheme 'none'; cannot decode the body — refusing to write raw bytes to disk. This exactly matches the reporter's client log in #232.Cause
unsupported_content_encoding()innative/engine/src/downloader.rs:641-667only whitelistsidentityand""as no-op tokens; any other token (includingnone) is treated as an unknown/undecodable encoding layer and returned asSome(...). The caller atdownloader.rs:3623(single-stream path) andsegment_coordinator.rs:4752(segmented path) both turn that into a hard error. This failure is deliberately excluded from the retriable-error set (see the comment above the call site), so it can never self-recover — every future attempt against that server fails identically.detect_content_encoding()already treated unknown tokens (includingnone) as a no-op (falls through toNone), so the two gates disagreed with each other.Fix
"none"to the no-op arm ofunsupported_content_encoding()alongside"identity"and"", with a comment explaining why (BUG-HTTP-NONE-ENCODING-FALSE-POSITIVE).downloader.rsand segmentedsegment_coordinator.rs) share this function, so the fix applies to both download paths without further changes.none/identity/gzipare accepted as no-op; unknown tokens (compress) and multi-layer encodings (gzip, gzip) still correctly rejected — locking in both the fix and the existing protection this function provides.Verification
Not built or tested in this environment (no Rust/Flutter toolchain available here). Verified statically:
unsupported_content_encoding("none")through the match arms: previously fell into theotherarm (has_unknown = true) producing the exact reported error string; now matches the"identity" | "none" | ""no-op arm and returnsNone.detect_content_encodingrequires no change — it already maps unknown tokens (includingnone) toNone, so the body is correctly treated as already-uncompressed and written as-is.{/7}in the function).#[test]cases mirroring the existingdetect_content_encoding_*test style in the same module; not executed (no cargo).Please run before merge:
cargo check -p fluxdown_engine --libcargo nextest run -p fluxdown_engine unsupported_content_encodingcargo nextest run -p fluxdown_engine detect_content_encodingKnown unaffected/not covered:
fluxdown_api,hub,server, Dart/web clients — this is purely an engine-internal HTTP response classification fix, no wire contract or DB schema change.Fixes #232