Repository navigation
Conversation
Reuse the existing HTTP date formatter and remove the direct Chrono dependency. Preserve per-second caching and clamp dates beyond the four-digit year range to avoid formatter panics.
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.
Closes #1131.
pingora-coreuses Chrono only for HTTP Date header formatting, while already depending onhttpdate. Reusehttpdate::fmt_http_dateand remove the direct Chrono dependency without changing the thread-local, per-second header cache or adding dependencies. This also removes that direct source of the Chrono maintenance advisory (RUSTSEC-2026-0543).Formatting is identical from the Unix epoch through
9999-12-31T23:59:59Z. Because httpdate panics for later dates, clamp those values to the last four-digit HTTP date. This deliberately replaces Chrono's extended-year output for out-of-range clocks; existing pre-epoch clock handling is unchanged. Formatting still produces one temporary String per cache refresh, with no additional allocation on cache hits.Replace the wall-clock-dependent cache assertion with deterministic coverage of same-second allocation reuse, second rollover and backward clock adjustment. Add epoch, RFC example, leap-day/century, upper-bound and out-of-range cases.
Validation on macOS/aarch64 with Rust 1.93.1:
cargo fmt --all -- --checkandgit diff --checkpass.cargo test -p pingora-core --lib protocols::http::date --no-default-features: 3 passed.cargo test -p pingora-core --lib protocols::http --no-default-features: 521 passed, 1 ignored.cargo tree -p pingora-core --edges normal --no-default-featurescontains httpdate and no Chrono. Optional features may still bring their own transitive dependencies.The full workspace/TLS matrix is left to upstream CI.