Skip to content

Commit 6b0baaa

Browse files
authored
Unsupported algos
1 parent 97cc1f4 commit 6b0baaa

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

draft-kleidl-digest-fields-problem-types.md

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,71 @@ The terms "integrity fields" and "integrity preference fields" are from {{DIGEST
7474

7575
## Unsupported Hashing Algorithm
7676

77-
This section defines the "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm" problem type {{PROBLEM}}. A server MAY use this problem type when responding to a request, whose integrity or integrity preference fields reference a hashing algorithm that the server can not or does not want to support for this request, and if the server wants to indicate this problem to the sender.
77+
This section defines the "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm" problem type {{PROBLEM}}.
78+
A server MAY use this problem type if it wants to communicate to the client that
79+
none of the hashing algorithms referenced in the integrity or integrity preference fields present in the request,
80+
is supported.
7881

79-
For this problem type, the `unsupported-algorithm` is defined as the only extension member. It SHOULD be populated in a response using this problem type, with its value being the algorithm key of the unsupported algorithm from the request. The response SHOULD include the corresponding integrity preference field to indicate the server's algorithm support and preference.
82+
For this problem type, the `unsupported-algorithm` is defined as the only extension member.
83+
It SHOULD be populated in a response using this problem type, with its value being the algorithm key of the unsupported algorithm from the request.
84+
The response SHOULD include the corresponding integrity preference field to indicate the server's algorithm support and preference.<!-- I am currently not sure whether to use normative language here. -->
8085

81-
The following example shows a response for a request with an integrity field utilizing an unsupported hashing algorithm `foo`. The response also includes a list of supported algorithms.
86+
Example:
87+
88+
~~~ http-message
89+
POST /books HTTP/1.1
90+
Host: foo.example
91+
Content-Type: application/json
92+
Accept: application/json
93+
Accept-Encoding: identity
94+
Repr-Digest: sha-256=:mEkdbO7Srd9LIOegftO0aBX+VPTVz7/CSHes2Z27gc4=:
95+
96+
{"title": "New Title"}
97+
~~~
98+
{: title="A request with a sha-256 integrity field, which is not supported by the server"}
8299

83100
~~~ http-message
84101
HTTP/1.1 400 Bad Request
85102
Content-Type: application/problem+json
86-
Want-Content-Digest: sha-512=3, sha-256=10
103+
Want-Repr-Digest: sha-512=10, sha-256=0
87104

88105
{
89106
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
90-
"title": "hashing algorithm is not supported",
91-
"unsupported-algorithm": "foo"
107+
"title": "Unsupported hashing algorithm",
108+
"unsupported-algorithm": "sha-256"
109+
}
110+
~~~
111+
{: title="Response Advertising the Supported Algorithms"}
112+
113+
114+
This problem type is a hint to the client about algorithm support, which the client could use to retry the request with a different, supported, algorithm.
115+
116+
Note that a request may contain more than one integrity field,
117+
and this problem type can be used both when a request contains an integrity preference field, e.g.
118+
119+
~~~ http-message
120+
GET /items/123 HTTP/1.1
121+
Host: foo.example
122+
Want-Repr-Digest: sha=10
123+
124+
~~~
125+
{: title="GET Request with Want-Repr-Digest"}
126+
127+
~~~ http-message
128+
HTTP/1.1 400 Bad Request
129+
Content-Type: application/problem+json
130+
Want-Repr-Digest: sha-512=10, sha-256=3
131+
132+
{
133+
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
134+
"title": "Unsupported hashing algorithm",
135+
"unsupported-algorithm": "sha"
92136
}
93137
~~~
138+
{: title="Response Advertising the Supported Algorithms"}
139+
140+
94141

95-
This problem type is a hint to the client about algorithm support, which the client could use to retry the request with a different algorithm supported by the server.
96142

97143
## Invalid Digest Value
98144

0 commit comments

Comments
 (0)