Skip to content

Quick wins: fix health check, 400 responses, logging, perf, and compatibility#45

Merged
JoshCap20 merged 11 commits into
mainfrom
fix/quick-wins-batch
Feb 25, 2026
Merged

Quick wins: fix health check, 400 responses, logging, perf, and compatibility#45
JoshCap20 merged 11 commits into
mainfrom
fix/quick-wins-batch

Conversation

@JoshCap20
Copy link
Copy Markdown
Owner

@JoshCap20 JoshCap20 commented Feb 25, 2026

Summary

Batch of quick-win issues — fixes, refactors, and perf improvements:

Additional improvements from self-review:

  • Normalized all error response constants: consistent naming (BAD_GATEWAY_RESPONSE), no stray Content-Type on bodiless responses
  • Added integration tests for 400 Bad Request behavior (malformed + empty requests)
  • Added explanatory comment on best-effort write pattern

Test plan

  • 68 unit tests pass
  • 2 new integration tests pass (malformed_request)
  • cargo fmt --check clean
  • cargo clippy -- -D warnings clean

Closes #15, #18, #20, #30, #31, #41, #42

🤖 Generated with Claude Code

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
…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.
@JoshCap20 JoshCap20 merged commit 687bbe7 into main Feb 25, 2026
1 check failed
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.

Health check intercepts upstream /health requests

1 participant