Go to file
openharmony_ci 59a0263213
!2 README.OpenSource 中License信息整改
Merge pull request !2 from peizhe/master
2023-05-05 02:26:24 +00:00
.github/workflows Rustfmt/clippy ignore, add benchmarks to clippy/check CI runs 2021-11-17 12:10:38 +01:00
benches Rustfmt/clippy ignore, add benchmarks to clippy/check CI runs 2021-11-17 12:10:38 +01:00
fuzz Remove unsafe in parser, also make it faster! 2021-11-17 12:10:38 +01:00
src Rustfmt/clippy ignore, add benchmarks to clippy/check CI runs 2021-11-17 12:10:38 +01:00
.gitignore initial commit 2016-10-02 22:29:41 +02:00
BUILD.gn Add GN Build Files and Custom Modifications 2023-04-18 18:14:02 +08:00
Cargo.toml Release version 1.0.2 2021-11-17 12:29:48 +01:00
LICENSE-APACHE initial commit 2016-10-02 22:29:41 +02:00
LICENSE-MIT initial commit 2016-10-02 22:29:41 +02:00
README.md Add GitHub Actions CI and update README 2021-03-29 21:03:42 +02:00
README.OpenSource README.OpenSource 中License信息整改 2023-05-04 09:26:42 +08:00

Date and time utils for HTTP.

Build Status Crates.io Documentation

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. Rusts 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 time
  • fmt_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.