94f8f9398c
This is a reproducible commit. Running mach tb-rust vendor again with mozilla-central and comm-central on the same head revs will produce the same output. https://hg.mozilla.org/mozilla-central/rev/55cd203304b8d5343dd941d772085dc25fd278c4 https://hg.mozilla.org/comm-central/rev/8a0750b85f6d85fbf5c2e17a29fbc8112112c374 |
||
---|---|---|
.. | ||
benches | ||
src | ||
.cargo-checksum.json | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
README.md
Date and time utils for HTTP.
Multiple HTTP header fields store timestamps.
For example a response created on May 15, 2015 may contain the header
Date: Fri, 15 May 2015 15:34:21 GMT
. Since the timestamp does not
contain any timezone or leap second information it is equvivalent to
writing 1431696861 Unix time. Rust’s SystemTime
is used to store
these timestamps.
This crate provides two public functions:
parse_http_date
to parse a HTTP datetime string to a system timefmt_http_date
to format a system time to a IMF-fixdate
In addition it exposes the HttpDate
type that can be used to parse
and format timestamps. Convert a sytem time to HttpDate
and vice versa.
The HttpType
(8 bytes) is smaller than SystemTime
(16 bytes) and
using the display impl avoids a temporary allocation.
Read the blog post to learn more.
Fuzz it by installing cargo-fuzz and running cargo fuzz run fuzz_target_1
.