Skip to content

Commit

Permalink
feat: add support for the digest headers
Browse files Browse the repository at this point in the history
This commit adds support for the following headers:
  * Repr-Digest
  * Content-Digest
  * Want-ReprDigest
  * Want-Content-Digest

These headers are defined in the following upcoming RFC:

https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-digest-headers-08

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
  • Loading branch information
npmccallum committed Mar 30, 2022
1 parent c28945c commit b5eb0c2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/header/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ standard_headers! {
/// is not mandatory.
(Connection, CONNECTION, "connection");

/// A cryptographic digest over the message contents.
///
/// For example:
///
/// ```
/// Content-Digest: sha-256=:4REjxQ4yrqUVicfSKYNO/cF9zNj5ANbzgDZt3/h3Qxo=:
/// ```
///
/// As this is a structured field (dictionary), multiple digests may be
/// specified. This header may be used in either requests or responses.
(ContentDigest, CONTENT_DIGEST, "content-digest");

/// Indicates if the content is expected to be displayed inline.
///
/// In a regular HTTP response, the Content-Disposition response header is a
Expand Down Expand Up @@ -778,6 +790,18 @@ standard_headers! {
/// refreshed.
(Refresh, REFRESH, "refresh");

/// A cryptographic digest over the "selected representation data."
///
/// For example:
///
/// ```
/// Repr-Digest: sha-256=:4REjxQ4yrqUVicfSKYNO/cF9zNj5ANbzgDZt3/h3Qxo=:
/// ```
///
/// As this is a structured field (dictionary), multiple digests may be
/// specified. This header may be used in either requests or responses.
(ReprDigest, REPR_DIGEST, "repr-digest");

/// The Retry-After response HTTP header indicates how long the user agent
/// should wait before making a follow-up request. There are two main cases
/// this header is used:
Expand Down Expand Up @@ -902,6 +926,34 @@ standard_headers! {
/// request/response chain.
(Via, VIA, "via");

/// Indicates preference for a particular content digest algorithm.
///
/// For example:
///
/// ```
/// Want-Content-Digest: sha-512=3, sha-256=10, unixsum=0
/// ```
///
/// This dictionary structured field contains digest algorithms as keys
/// and the preference (`0`-`10`, inclusive) for that algorithm. `10`
/// indicates the most preferred algorithm and `0` indicates "not
/// acceptable".
(WantContentDigest, WANT_CONTENT_DIGEST, "want-content-digest");

/// Indicates preference for a particular representation digest algorithm.
///
/// For example:
///
/// ```
/// Want-Repr-Digest: sha-512=3, sha-256=10, unixsum=0
/// ```
///
/// This dictionary structured field contains digest algorithms as keys
/// and the preference (`0`-`10`, inclusive) for that algorithm. `10`
/// indicates the most preferred algorithm and `0` indicates "not
/// acceptable".
(WantReprDigest, WANT_REPR_DIGEST, "want-repr-digest");

/// General HTTP header contains information about possible problems with
/// the status of the message.
///
Expand Down

0 comments on commit b5eb0c2

Please sign in to comment.