Want-Digest HTTP Header: Syntax, Directive, Examples

The Want-Digest HTTP header is most commonly used in an HTTP request to request that the server give a digest of the requested resource using the Digest response header. The header includes identifiers for one or more digest algorithms that the sender wants the server to employ to generate the digest. Quality values can be used by the request to indicate its preference/order for specific digest algorithms. The Digest’s reply The HTTP header contains a digest of the representation of the requested resource that was chosen. If Want-Digest does not contain any digest algorithms that the server supports, the server may respond with a digest generated using a different digest algorithm or with a 400 Bad Request error, followed by another Want-Digest header stating the algorithms that the server does support. The HTTP status code 400 Bad Request indicates that the server is unable or unwilling to accept the request owing to what is regarded to be a client mistake, such as improper request syntax, erroneous request message framing, or deceptive request routing. There are multiple values for the Want Digest HTTP. The syntax of the Want Digest HTTP needs an “algorithm” and a “q value” to create the digest within the header. The algorithm is a sequence of instructions used to solve a problem or perform a task. The algorithm supports SHA-256, MD5, and SHA-512 digest algorithms. Quality values often referred to as q-values and q-factors, are used to indicate the order of precedence of values in a comma-separated list. The q value stores the quality factor associated with the algorithms. It ranges from 0 to 1, with 1 being the highest. Following is an example of an HTTP response for a single algorithm and for an algorithm with a q value. 

Single Algorithm use example of Want-Digest HTTP header is below.

Want-Digest: sha-512

Algorithm with “q value” for use of the Want-digest HTTP Header is below.

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

Want Digest HTTP Request Header can be seen above. In this article, the Want Digest HTTP Syntax, Directives, and Uses with examples will be processed.

What is the Want-Digest HTTP Header?

The Want Digest HTTP is typically used in HTTP requests to request that the server give a digest of the requested resource through the Digest response header. The Digest’s reply The HTTP header contains a digest of the representation of the requested resource that was chosen. In the header, the requester provides one or more digest algorithms that can be utilized to construct the digest. An HTTP 400 Bad Request is sent if a server doesn’t support certain methods, and a list of supported algorithms is included in the HTTP Want-Digest Header.

What is the Syntax of the Want-Digest HTTP Header?

The Want-Digest HTTP contains two parts in its syntax. The syntax for using Want-Digest is as follows.

Want-Digest: <algorithm><q-value>, <algorithm><q-value>
Want-Digest: <algorithm>

The Syntax of the Want-Digest HTTP Header for a single algorithm includes X….

  • For single algorithm
Want-Digest: <algorithm>
  • The syntax for more than one algorithm plus a quality value

The Want-Digest syntax header can contain multiple digest algorithms.

What are the Directives of Want-Digest HTTP Header?

The Want-Digest accepts two directives mentioned above and described below.

  • <algorithm>: This directive says that the algorithms that can be used for digests include SHA-256, MD5, and SHA-512.
  • <q-value>: This directive holds the quality factor that is linked to the algorithms to show which algorithms are more important. It goes from 0 to 1, with 1 being the most important.

This example shows a single digest algorithm that doesn’t have the value of that algorithm.

Want-Digest: sha-512

This sample contains multiple digest algorithms, each with its own quality value.

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

How to use the Want-Digest HTTP Header?

The HTTP header Want-Digest is typically used in HTTP requests to request that the server give a digest of the requested resource through the Digest response header. The header has the names of one or more algorithms that the sender wants the server to use to make the digest. Requests can use quality values to show how much they like or don’t like certain digest algorithms.

If Want-Digest doesn’t include any digest algorithms that the server can use, the server may say something like.

  • A digest that was made with a different digest algorithm
  • A 400 Bad Request error, and add another Want-Digest header with that response that lists the algorithms that it can work with.

Examples of Want-Digest Use HTTP Header

Examples of Want-Digest are shown below.

The basic Information example below is that the sender gives the server a list of digests that it can accept, and the server picks 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=X48E9qOokqqrvndts8JOJRHN3OGDUoyWxBf7kbu9DBPE=

The unsupported Digests example below is that the server doesn’t support any of the digest algorithms you asked for, so it uses a different one.

  • Request
GET /item
Want-Digest: sha;q=1
  • Response
HTTP/1.1 200 Ok
Digest: sha-256=X48E9qOokqqrvdts8oOKRJN7OWDUoyTxBf7pbu9DPPE=

And another example of Unsupported Digest below is if the server doesn’t support any of the digest algorithms that you asked for. In this case, it responds with a 400 error and adds another header called “Want-Digest,” which lists the algorithms that it can use.

  • Request
GET /item
Want-Digest: sha;q=1
  • Response
HTTP/1.1 400 Bad Request
Want-Digest: sha-256, sha-512

What are the Specification Documents for Want-Digest HTTP Header?

There is only one specification document for the Want-Digest HTTP Header which is the RFC3230. The RFC 3230 mentioned the Want-Digest HTTP header field, which indicates the sender’s desire to receive an instance digest of the message associated with the request-URI. Additionally, this article discusses the Want-Digest HTTP Header’s definition and usage.

What are the types of Want-Digest HTTP Header?

The Want-Digest HTTP Header HTTP Type is listed below.

  1. Response Headers is a type of Want Digest HTTP because it returns a digest calculated using a different digest algorithm and a 400 Bad request if the Want-Digest HTTP request does not include any digest algorithms supported by the server.
  2. Representation Header is a Want-Digest HTTP because it contains an identifier for one or more digest algorithms that the sender would like the server to employ to construct the digest.

What are the similar HTTP Headers to the Want-Digest HTTP Header?

There is only one similar HTTP Header to the Want-Digest HTTP Header which is the Wide-Digest HTTP Header. The Want-Digest HTTP Header is similar to Wide-Digest HTTP Header because it contains identifiers for more algorithms and data. algorithms and data.

Which Browsers Support Want-Digest HTTP Header? 

The compatibility of browsers for the Want-DigestHTTP Header is unknown.

Koray Tuğberk GÜBÜR

Leave a Comment

Want-Digest HTTP Header: Syntax, Directive, Examples

by Koray Tuğberk GÜBÜR time to read: 5 min
0