Skip to content

Commit 193daf2

Browse files
authored
Merge pull request #13 from ioggstream/ioggstream-editorial-2
Unsupported algos
2 parents e93b1d3 + abbf5c7 commit 193daf2

File tree

1 file changed

+52
-7
lines changed

1 file changed

+52
-7
lines changed

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

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,70 @@ The term "request", "response", "intermediary", "sender", and "server" are from
8181

8282
## Unsupported Hashing Algorithm
8383

84-
This section defines the "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm" problem type. 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.
84+
This section defines the "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm" problem type.
85+
A server MAY use this problem type if it wants to communicate to the client that
86+
one of the hashing algorithms referenced in the integrity or integrity preference fields present in the request
87+
is not supported.
8588

86-
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.
89+
For this problem type, `unsupported-algorithm` is defined as the only extension member.
90+
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.
91+
The response can include the corresponding integrity preference field to indicate the server's algorithm support and preference.
8792

88-
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.
93+
Example:
94+
95+
~~~ http-message
96+
POST /books HTTP/1.1
97+
Host: foo.example
98+
Content-Type: application/json
99+
Accept: application/json
100+
Accept-Encoding: identity
101+
Repr-Digest: sha-256=:mEkdbO7Srd9LIOegftO0aBX+VPTVz7/CSHes2Z27gc4=:
102+
103+
{"title": "New Title"}
104+
~~~
105+
{: title="A request with a sha-256 integrity field, which is not supported by the server"}
89106

90107
~~~ http-message
91108
HTTP/1.1 400 Bad Request
92109
Content-Type: application/problem+json
93-
Want-Content-Digest: sha-512=3, sha-256=10
110+
Want-Repr-Digest: sha-512=10, sha-256=0
94111

95112
{
96113
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
97-
"title": "hashing algorithm is not supported",
98-
"unsupported-algorithm": "foo"
114+
"title": "Unsupported hashing algorithm",
115+
"unsupported-algorithm": "sha-256"
116+
}
117+
~~~
118+
{: title="Response Advertising the Supported Algorithms"}
119+
120+
121+
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.
122+
123+
Note that a request may contain more than one integrity field.
124+
This problem type can also be used when a request contains an integrity preference field, e.g.
125+
126+
~~~ http-message
127+
GET /items/123 HTTP/1.1
128+
Host: foo.example
129+
Want-Repr-Digest: sha=10
130+
131+
~~~
132+
{: title="GET Request with Want-Repr-Digest"}
133+
134+
~~~ http-message
135+
HTTP/1.1 400 Bad Request
136+
Content-Type: application/problem+json
137+
138+
{
139+
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
140+
"title": "Unsupported hashing algorithm",
141+
"unsupported-algorithm": "sha"
99142
}
100143
~~~
144+
{: title="Response Advertising the Supported Algorithms"}
145+
146+
101147

102-
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.
103148

104149
## Invalid Digest Value
105150

0 commit comments

Comments
 (0)