Skip to content

Commit

Permalink
Merge pull request #19 from tus/prefix
Browse files Browse the repository at this point in the history
Use `digest-` prefix for problem types
  • Loading branch information
Acconut authored Oct 21, 2024
2 parents d785d87 + c0957e5 commit fb4a58b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions draft-kleidl-digest-fields-problem-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Content-Type: application/problem+json
Want-Content-Digest: sha-512=3, sha-256=10

{
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
"type": "https://iana.org/assignments/http-problem-types#digest-unsupported-algorithm",
"title": "hashing algorithm is not supported",
"unsupported-algorithm": "foo"
}
Expand All @@ -87,7 +87,7 @@ The term "request", "response", "intermediary", "sender", and "server" are from

## Unsupported Hashing Algorithm

This section defines the "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm" problem type.
This section defines the "https://iana.org/assignments/http-problem-types#digest-unsupported-algorithm" problem type.
A server MAY use this problem type if it wants to communicate to the client that
one of the hashing algorithms referenced in the integrity or integrity preference fields present in the request
is not supported.
Expand Down Expand Up @@ -116,7 +116,7 @@ Content-Type: application/problem+json
Want-Repr-Digest: sha-512=10, sha-256=0

{
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
"type": "https://iana.org/assignments/http-problem-types#digest-unsupported-algorithm",
"title": "Unsupported hashing algorithm",
"unsupported-algorithm": "sha-256"
}
Expand All @@ -142,7 +142,7 @@ HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{
"type": "https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm",
"type": "https://iana.org/assignments/http-problem-types#digest-unsupported-algorithm",
"title": "Unsupported hashing algorithm",
"unsupported-algorithm": "sha"
}
Expand All @@ -151,7 +151,7 @@ Content-Type: application/problem+json

## Invalid Digest Value

This section defines the "https://iana.org/assignments/http-problem-types#invalid-digest-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value, that cannot be generated by the corresponding hashing algorithm. For example, if the digest value of the `sha-512` hashing algorithm is not 64 bytes long, it cannot be a valid digest value and the server can skip computing the digest value. This problem type MUST NOT be used if the server is not able to parse the integrity fields according to {{Section 4.5 of STRUCTURED-FIELDS}}, for example because of a syntax error in the field value.
This section defines the "https://iana.org/assignments/http-problem-types#digest-invalid-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value, that cannot be generated by the corresponding hashing algorithm. For example, if the digest value of the `sha-512` hashing algorithm is not 64 bytes long, it cannot be a valid digest value and the server can skip computing the digest value. This problem type MUST NOT be used if the server is not able to parse the integrity fields according to {{Section 4.5 of STRUCTURED-FIELDS}}, for example because of a syntax error in the field value.

The server SHOULD include a human-readable description why the value is considered invalid in the `title` member.

Expand All @@ -172,7 +172,7 @@ HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{
"type": "https://iana.org/assignments/http-problem-types#invalid-digest-value",
"type": "https://iana.org/assignments/http-problem-types#digest-invalid-value",
"title": "digest value for sha-512 is not 64 bytes long"
}
~~~
Expand All @@ -182,7 +182,7 @@ This problem type indicates a fault in the sender's calculation or encoding of t

## Mismatching Digest Value

This section defines the "https://iana.org/assignments/http-problem-types#mismatching-digest-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value that does not match the digest value that the server calculated for the request content or representation.
This section defines the "https://iana.org/assignments/http-problem-types#digest-mismatching-value" problem type. A server MAY use this problem type when responding to a request, whose integrity fields include a digest value that does not match the digest value that the server calculated for the request content or representation.

Three problem type extension members are defined: the `algorithm`, `provided-digest`, and `calculated-digest` members. A response using this problem type SHOULD populate all members, with the value of `algorithm` being the algorithm key of the used hashing algorithm, with the value of `provided-digest` being the digest value taken from the request's integrity fields, and the value of `calculated-digest` being the calculated digest. The digest values MUST BE serialized as byte sequences as described in {{Section 4.1.8 of STRUCTURED-FIELDS}}.

Expand All @@ -203,7 +203,7 @@ HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{
"type": "https://iana.org/assignments/http-problem-types#mismatching-digest-value",
"type": "https://iana.org/assignments/http-problem-types#digest-mismatching-value",
"title": "digest value fromr request does not match expected value",
"algorithm": "sha-256",
"provided-digest": ":RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:",
Expand All @@ -227,10 +227,10 @@ and prefer a general problem type over a more specific one.

IANA is asked to register the following entries in the "HTTP Problem Types" registry at <https://www.iana.org/assignments/http-problem-types>.

## Registration of "unsupported-hashing-algorithm" Problem Type
## Registration of "digest-unsupported-algorithm" Problem Type

Type URI:
: https://iana.org/assignments/http-problem-types#unsupported-hashing-algorithm
: https://iana.org/assignments/http-problem-types#digest-unsupported-algorithm

Title:
: Unsupported Hashing Algorithm
Expand All @@ -241,10 +241,10 @@ Recommended HTTP status code:
Reference:
: {{unsupported-hashing-algorithm}} of this document

## Registration of "invalid-digest-value" Problem Type
## Registration of "digest-invalid-value" Problem Type

Type URI:
: https://iana.org/assignments/http-problem-types#invalid-digest-value
: https://iana.org/assignments/http-problem-types#digest-invalid-value

Title:
: Invalid Digest Value
Expand All @@ -255,10 +255,10 @@ Recommended HTTP status code:
Reference:
: {{invalid-digest-value}} of this document

## Registration of "mismatching-digest-value" Problem Type
## Registration of "digest-mismatching-value" Problem Type

Type URI:
: https://iana.org/assignments/http-problem-types#mismatching-digest-value
: https://iana.org/assignments/http-problem-types#digest-mismatching-value

Title:
: Mismatching Digest Value
Expand Down

0 comments on commit fb4a58b

Please sign in to comment.