Quick wins: fix health check, 400 responses, logging, perf, and compatibility#45
Merged
Conversation
No caller uses the byte count. Removes unnecessary return value. Closes #18
…lity No 2024-specific features were in use. Edition 2021 supports Rust 1.56+. Closes #20
Previously, malformed requests caused a silent connection drop. Now sends a proper HTTP 400 response before closing. Closes #30
The error from resolve_and_verify_non_private already distinguishes DNS resolution failure from rebinding detection. Call sites no longer wrap all errors as "DNS rebinding". Closes #31
…String allocation Uses itoa for zero-alloc u16 formatting. Closes #41
…g allocations Closes #42
…endency The write_status_line approach traded a ~30-byte String for 5 async write_all calls and a new dependency. format!() is simpler, equally fast on a BufWriter, and avoids unnecessary supply chain surface.
Rename BAD_GATEWAY_RESPONSE_HEADER to BAD_GATEWAY_RESPONSE and remove the Content-Type header to match the style of BAD_REQUEST_RESPONSE and FORBIDDEN_RESPONSE (no body, no Content-Type).
Verifies that garbage request lines and empty requests both receive a proper HTTP 400 response instead of a silent connection drop.
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.
Summary
Batch of quick-win issues — fixes, refactors, and perf improvements:
/healthrequests — only relative/health(targeting the proxy itself) is matchedread_line_boundedreturn type simplified fromResult<usize>toResult<()>400 Bad Requestresponse instead of a silent connection dropbuild_proxy_status_linekept asformat!()(reviewed and confirmed: simpler than alternatives, negligible cost on BufWriter)parse_host_portreturns&strinstead ofString, eliminating per-CONNECT allocationAdditional improvements from self-review:
BAD_GATEWAY_RESPONSE), no strayContent-Typeon bodiless responsesTest plan
cargo fmt --checkcleancargo clippy -- -D warningscleanCloses #15, #18, #20, #30, #31, #41, #42
🤖 Generated with Claude Code