Want-Digest

Vous lisez la version anglaise de ce contenu car il n’existe pas encore de traduction dans cette langue. Aidez-nous à traduire cet article !

The Want-Digest HTTP header is primarily used in a HTTP request, to ask the responder to provide a digest of the requested resource using the Digest response header.

The header contains identifiers for one or more digest algorithms that the sender wishes the responder to use to create the digest. The sender may use quality values to indicate its preference ordering among the choices it offers.

If Want-Digest does not include any digest algorithms that the server supports, the server may respond with:

  • a digest calculated using a different digest algorithm, or
  • a 400 Bad Request error, and include another Want-Digest header with that response, listing the algorithms that it does support.

See the page for the Digest header for more information.

Header type General header
Forbidden header name no

Syntax

Want-Digest: <digest-algorithm>

// Multiple algorithms, weighted with the quality value syntax:
Want-Digest: <digest-algorithm><q-value>,<digest-algorithm><q-value>

Directives

<digest-algorithm>
Supported digest algorithms are defined in RFC 3230 and RFC 5843, and include SHA-256 and SHA-512. Some of the supported algorithms, including unixsum and MD5 are subject to collisions and are thus not suitable for applications in which collision-resistance is important.
<q-value>
The quality value to apply to that option.

Examples

Want-Digest: sha-256
Want-Digest: SHA-512;q=0.3, sha-256;q=1, md5;q=0

Basic operation

The sender provides a list of digests which it is prepared to accept, and the server uses one of them:

Request:

  GET /item
  Want-Digest: sha-256;q=0.3, sha;q=1

Response:

  HTTP/1.1 200 Ok
  Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=

Unsupported digests

The server does not support any of the requested digest algorithms, so uses a different algorithm:

Request:

  GET /item
  Want-Digest: sha;q=1

Response:

  HTTP/1.1 200 Ok
  Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=

The server does not support any of the requested digest algorithms, so responds with a 400 error and includes another Want-Digest header, listing the algorithms that it does support:

Request:

  GET /item
  Want-Digest: sha;q=1

Response:

  HTTP/1.1 400 Bad Request
  Want-Digest: sha-256, sha-512

Specifications

Specification Title

draft-ietf-httpbis-digest-headers-latest

Resource Digests for HTTP

This header was originally defined in RFC 3230, but the definition of "selected representation" in RFC 7231 made the original definition inconsistent with current HTTP specifications. When released, The "Resource Digests for HTTP" draft therefore will obsolete RFC 3230 and will update the standard to be consistent.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Want-DigestChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support

See also