Want-Digest
The Want-Digest
HTTP header is primarily used in a request, to ask the server 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 server to use to create the digest. The request may use quality values to indicate its preference/order for particular digest algorithms.
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 anotherWant-Digest
header with that response, listing the algorithms that it does support.
See the page for the Digest
header for more information.
Header type | Request header, Response 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>
-
Digest algorithms are defined in Digest Headers.
- Permitted digest algorithms values include:
unixsum
,unixcksum
,crc32c
,sha-256
andsha-512
,id-sha-256
,id-sha-512
- Deprecated algorithms values include:
md5
,sha
,adler32
.
- Permitted digest algorithms values include:
- <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.
In this case it 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 |
---|
Unknown specification # section-4 |
Browser compatibility
BCD tables only load in the browser