diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/httpdate/README.md | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/httpdate/README.md')
-rw-r--r-- | third_party/rust/httpdate/README.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/rust/httpdate/README.md b/third_party/rust/httpdate/README.md new file mode 100644 index 0000000000..c90c6f4252 --- /dev/null +++ b/third_party/rust/httpdate/README.md @@ -0,0 +1,27 @@ +# Date and time utils for HTTP. + +[![Build Status](https://travis-ci.org/pyfisch/httpdate.svg?branch=master)](https://travis-ci.org/pyfisch/httpdate) +[![Crates.io](https://img.shields.io/crates/v/httpdate.svg)](https://crates.io/crates/httpdate) +[![Documentation](https://docs.rs/httpdate/badge.svg)](https://docs.rs/httpdate) + +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 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](https://pyfisch.org/blog/http-datetime-handling/) to learn +more. + +Fuzz it by installing *cargo-fuzz* and running `cargo fuzz run fuzz_target_1`. |