Repository navigation
Conversation
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.
DuckDuckGo HTTP 202 responses currently reach the success path because the challenge check sits inside
!status.is_success(). The existing empty-body test passes through a separate body heuristic, so it misses this bug. Classify 202 before checking success, and exercise it with an otherwise valid results page both with and without fallback enabled.Search providers also collect entire response bodies before parsing. Add a shared bounded reader for HTML and JSON responses, with a configurable 2 MiB default through
HttpConfig::with_max_response_bytes. It rejects oversized declared lengths and checks every received chunk before accumulation, including responses without a length header. Oversized bodies return a structured, non-retryableResponseTooLargeerror; callers can continue supplying their own HTTP client.Regression coverage includes exact size boundaries, chunked transfer, JSON parse errors, error serialization, and provider-level enforcement without retries or DuckDuckGo fallback. The change also removes an unused DuckDuckGo dependency, gates feature-specific test imports, and updates one existing assertion for current stable Clippy.
Validation on macOS with the repository's stable toolchain:
cargo fmt --all --checkcargo check --workspace --all-featurescargo clippy --workspace --all-targets --all-features -- -D warningscargo build --workspace --all-featurescargo test --workspace --all-features— 305 passed, one existing ignored testThe strengthened HTTP 202 regression was confirmed to fail before the fix. Tests use local HTTP fixtures; no live search-provider validation is claimed.