Skip to content

Commit fee7219

Browse files
authored
Editorial suggestions from Roberto Polli (#3348)
Most (but not all 😄 ) suggestions from @ioggstream. Some of these triggered memories from RFC editor feedback on 9530 so applying now should ensure some good consistency - **Add some imports in the conventions and definitions** - **omit one -> omit the field** - **gzip example wording** - **hashing of entire selected representation data** - **sprinkle some s/coding/codings around** - **s/body/content** - **Improve HTTP in examples to avoid a call from the protocol police**
1 parent a7dbd05 commit fee7219

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

draft-ietf-httpbis-unencoded-digest.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ field value that indicates a series of encodings adds further complexity.
7979
A more complex example involves HTTP Range Requests ({{Section 14 of
8080
HTTP}}), where a client fetches multiple partial representations from
8181
different origins and "stitches" them back into a whole. Unfortunately, if the
82-
origins apply different content coding, the `Repr-Digest` field will vary by the
82+
origins apply different content codings, the `Repr-Digest` field will vary by the
8383
server's selected encoding (i.e. the Content-Encoding header field, {{Section
8484
8.4 of HTTP}}). This provides a challenge for a client - in order to verify the
8585
integrity of the pieced-together whole it would need to remove the encoding of
8686
each part, combine them, and then encode the result in order to compare against
8787
one or more `Repr-Digest`s.
8888

8989
The Accept-Encoding header field ({{Section 12.5.3 of HTTP}}) provides the means
90-
to indicate preferences for content coding. It is possible for an endpoint to
90+
to indicate preferences for content codings. It is possible for an endpoint to
9191
indicate a preference for no encoding, for example by sending the "identity"
9292
token. However, codings often provide data compression that is advantageous.
9393
Disabling content coding in order to simplify integrity checking is possibly an
@@ -119,16 +119,21 @@ The definitions "representation", "selected representation", "representation
119119
data", "representation metadata", and "content" in this document are to be
120120
interpreted as described in {{!HTTP=RFC9110}}.
121121

122+
This document uses the line folding strategies described in {{!FOLDING=RFC8792}}.
123+
124+
The term "digest" is to be interpreted as described in {{DIGEST-FIELDS}}.
125+
122126

123127
# The Unencoded-Digest Field {#unencoded-digest}
124128

125129
The `Unencoded-Digest` HTTP field can be used in requests and responses to
126130
communicate digests that are calculated using a hashing algorithm applied to the
127-
representation with no content coding ({{Section 8.4.1 of HTTP}}).
131+
entire selected representation data with no content codings applied ({{Section
132+
8.4.1 of HTTP}}).
128133

129134
Apart from the content coding concerns, `Unencoded-Digest` behaves similarly
130135
to `Repr-Digest` ({{Section 3 of DIGEST-FIELDS}}). In the absence of content
131-
coding, `Unencoded-Digest` is identical to `Repr-Digest`.
136+
codings, `Unencoded-Digest` is identical to `Repr-Digest`.
132137

133138
`Unencoded-Digest` is a `Dictionary` (see {{Section 3.2 of STRUCTURED-FIELDS}})
134139
where each:
@@ -193,10 +198,10 @@ If `Want-Unencoded-Digest` is used in a response, it indicates that the server
193198
would like the client to provide the `Unencoded-Digest` field on future requests.
194199

195200
`Want-Unencoded-Digest` is only a hint. The receiver of the field can ignore it
196-
and send an `Unencoded-Digest` field using any algorithm or omit one entirely. It
197-
is not a protocol error if preferences are ignored. Applications that use
198-
`Unencoded-Digest` and `Want-Unencoded-Digest` can define expectations or
199-
constraints that operate in addition to this specification.
201+
and send an `Unencoded-Digest` field using any algorithm or omit the field
202+
entirely. It is not a protocol error if preferences are ignored. Applications
203+
that use `Unencoded-Digest` and `Want-Unencoded-Digest` can define expectations
204+
or constraints that operate in addition to this specification.
200205

201206
`Want-Unencoded-Digest` is of type `Dictionary` where each:
202207

@@ -220,13 +225,13 @@ Want-Unencoded-Digest: sha-512=3, sha-256=10, unixsum=0
220225
# Messages containing both Unencoded-Digest and Content-Encoding {#encoding-and-unencoded}
221226

222227
Digests delivered through `Unencoded-Digest` apply to the unencoded
223-
representation. If a message is received with content coding, a recipient needs
228+
representation. If a message is received with content codings, a recipient needs
224229
to decode the message in order to calculate the digest that can subsequently be
225230
used for validation. If multiple content codings are applied, the recipient
226231
needs to decode all encodings in order before validation.
227232

228233
Since the digest is calculated on unencoded representation bytes, validation of
229-
a message with content coding (as described above) can only succeed where the
234+
a message with content codings (as described above) can only succeed where the
230235
decoded output produces the same byte sequence as the input. While many
231236
registered content codings behave this way, there is no requirement for them to
232237
do so and it remains a possibility that decoding could produce a
@@ -239,10 +244,10 @@ is advised when selecting content coding for use with `Unencoded-Digest`.
239244
Integrity fields can be used in combination to address different and
240245
complementary needs, particularly the cases described in {{introduction}}.
241246

242-
In the following examples, the unencoded response data is the string "An
243-
unexceptional string" following by an LF. For presentation purposes, the
244-
response body is displayed as a sequence of hex-encoded bytes because it
245-
contains non-printable characters.
247+
In the following examples, the selected representation data with no content
248+
codings applied is: "An unexceptional string" following by an LF. For
249+
presentation purposes, the response content is displayed as a sequence of
250+
hex-encoded bytes because it contains non-printable characters.
246251

247252
The first example demonstrates a request that uses content negotiation.
248253

@@ -261,6 +266,7 @@ and `Unencoded-Digest` therefore differ.
261266
NOTE: '\' line wrapping per RFC 8792
262267

263268
HTTP/1.1 200 OK
269+
Content-Type: text/plain
264270
Content-Encoding: gzip
265271
Repr-Digest: \
266272
sha-256=:XyjvEuFb1P5rqc2le3vQm7M96DwZhvmOwqHLu2xVpY4=:
@@ -274,7 +280,7 @@ ca cc 4b e7 02 00 7e af 07 44
274280
18 00 00 00
275281

276282
~~~
277-
{: title="GET response with GZIP-encoded content"}
283+
{: title="GET response with GZIP content coding"}
278284

279285
The second example demonstrates a range request with content negotiation.
280286

@@ -287,18 +293,19 @@ Range: bytes=0-10
287293
~~~
288294
{: title="Range request with content negotiation"}
289295

290-
The server responds with a 206 Partial Content response using GZIP encoding, it
291-
has three different Integrity fields. The `Content-Digest` relates to the
292-
response message content that can be used to validate the integrity of the
296+
The server responds with a 206 (Partial Content) response using GZIP content
297+
coding, it has three different Integrity fields. The `Content-Digest` relates to
298+
the response content that can be used to validate the integrity of the
293299
received part. `Repr-Digest` and `Unencoded-Digest` can be used later once the
294300
entire object is reconstructed. The choice of which to use is left to the
295-
application that would consider a range of factors outside the scope of
296-
this document.
301+
application that would consider a range of factors outside the scope of this
302+
document.
297303

298304
~~~ http-message
299305
NOTE: '\' line wrapping per RFC 8792
300306

301307
HTTP/1.1 206 Partial Content
308+
Content-Type: text/plain
302309
Content-Encoding: gzip
303310
Content-Range: bytes 0-9/44
304311
Content-Digest: \
@@ -310,7 +317,7 @@ Unencoded-Digest: \
310317

311318
1f 8b 08 00 79 1f 08 64 00 ff
312319
~~~
313-
{: title="Partial response with GZIP encoding"}
320+
{: title="Partial response with GZIP content coding"}
314321

315322

316323
# Security Considerations

0 commit comments

Comments
 (0)