Skip to content

Commit 741b7e9

Browse files
authored
Update the httpChecksum trait spec (#2413)
1 parent 6a12923 commit 741b7e9

File tree

1 file changed

+54
-30
lines changed

1 file changed

+54
-30
lines changed

docs/source-2.0/aws/aws-core.rst

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -932,23 +932,21 @@ The ``httpChecksum`` trait is a structure that contains the following members:
932932
* - requestAlgorithmMember
933933
- ``string``
934934
- Defines a top-level operation input member that is used to configure
935-
request checksum behavior. The input member MUST target a string shape
936-
marked with the :ref:`enum-trait`. Each value in the enum represents a
937-
supported checksum algorithm. Algorithms MUST be one of the following
938-
supported values: "CRC64NVME", "CRC32C", "CRC32", "SHA1", or "SHA256".
935+
request checksum behavior. The input member MUST target an :ref:`enum`
936+
shape. Each value in the enum represents a supported checksum
937+
algorithm. Algorithms MUST be one of the following supported values:
938+
"CRC64NVME", "CRC32C", "CRC32", "SHA1", or "SHA256".
939939
* - requestChecksumRequired
940940
- ``boolean``
941-
- Indicates an operation requires a checksum in its HTTP request. By
942-
default, the checksum used for a service is an MD5 checksum passed
943-
in the Content-MD5 header. When the input member represented by the
944-
``requestAlgorithmMember`` property is set, the default behavior is
945-
disabled.
941+
- Indicates an operation requires a checksum in its HTTP request. If the
942+
input member represented by``requestAlgorithmMember`` property is not
943+
set, the client uses its default algorithm.
946944
* - requestValidationModeMember
947945
- ``string``
948-
- Defines a top-level operation input member used to opt-in to
949-
best-effort validation of a checksum returned in the HTTP response of
950-
the operation. The input member MUST target a string shape marked with
951-
the :ref:`enum-trait` that contains the value "ENABLED".
946+
- Defines a top-level operation input member used to opt-in to validation
947+
of a checksum returned in the HTTP response of the operation. The input
948+
member MUST target an :ref:`enum` shape that contains the value
949+
"ENABLED".
952950
* - responseAlgorithms
953951
- ``set<string>``
954952
- Defines the checksum algorithms clients SHOULD look for when validating
@@ -1027,18 +1025,33 @@ behavior, will fail validation.
10271025
Client behavior
10281026
===============
10291027

1028+
Supported checksum algorithms
1029+
-----------------------------
1030+
The following checksum algorithms MUST be supported by clients.
1031+
* CRC32
1032+
* SHA1
1033+
* SHA256
1034+
1035+
Additionally, the following checksum algorithms SHOULD be supported by clients.
1036+
* CRC64NVME
1037+
* CRC32C
1038+
10301039
HTTP request checksums
10311040
----------------------
10321041

1033-
When a client calls an operation which has the ``httpChecksum`` trait where
1034-
``requestChecksumRequired`` is set to ``true``, the client MUST include a
1035-
checksum in the HTTP request.
1042+
By default, when a client calls an operation which has the ``httpChecksum``
1043+
trait, the client MUST include a checksum in the HTTP request, unless the
1044+
client is configured to only include checksum when ``requestChecksumRequired``
1045+
is set to ``true``.
10361046

10371047
When a client calls an operation which has the ``httpChecksum`` trait where
10381048
``requestAlgorithmMember`` is set, the client MUST look up the input member
10391049
represented by ``requestAlgorithmMember`` property. The value of this member is
10401050
the checksum algorithm that the client MUST use to compute the request payload
1041-
checksum.
1051+
checksum. If the client does not support that algorithm, it MUST fail the
1052+
request. If the user did not set a value for the input member represented by
1053+
``requestAlgorithmMember``, the client MUST use its default algorithm and
1054+
implicitly set that value in ``requestAlgorithmMember``.
10421055

10431056
The computed checksum MUST be supplied at a resolved location as per the
10441057
:ref:`resolving checksum location <aws.protocols#httpChecksum-trait_resolving-checksum-location>`
@@ -1049,29 +1062,35 @@ of the body. The header or trailer name to use with an algorithm is resolved as
10491062
per the :ref:`resolving checksum name <aws.protocols#httpChecksum-trait_resolving-checksum-name>`
10501063
section.
10511064

1052-
If no ``requestAlgorithmMember`` property is set, the client MUST compute an
1053-
MD5 checksum of the request payload and place it in the ``Content-MD5`` header.
1065+
If no ``requestAlgorithmMember`` property is set in the trait and
1066+
``requestChecksumRequired`` is set to ``true``, the client MUST compute an MD5
1067+
checksum of the request payload and place it in the ``Content-MD5`` header.
10541068

10551069
If the HTTP header corresponding to a checksum is set explicitly, the client
10561070
MUST use the explicitly set header and skip computing the payload checksum.
10571071

1058-
.. seealso:: See :ref:`client behavior<aws.protocols#httpChecksum-trait_header-conflict-behavior>`
1059-
for more details.
1060-
10611072
HTTP response checksums
10621073
-----------------------
10631074

1075+
When a client calls an operation which has the ``httpChecksum`` trait, the
1076+
client MUST look up the input member represented by the
1077+
``requestValidationModeMember`` property. If the user did not set a value for
1078+
this member, by default the client MUST implicitly set it to ``ENABLED``,
1079+
unless the client is configured to opt-out of this default behavior.
1080+
10641081
When a client receives a response for an operation which has the ``httpChecksum``
10651082
trait where the ``requestValidationModeMember`` property is set, the client
10661083
MUST look up the input member represented by the property's value. If the input
1067-
member is set to ``ENABLED``, the client MUST perform best-effort validation of
1068-
checksum values returned in the HTTP response.
1084+
member is set to ``ENABLED``, the client MUST perform validation of checksum
1085+
returned in the HTTP response.
10691086

10701087
A client MUST use the list of supported algorithms modeled in the
1071-
``responseAlgorithms`` property to look up the checksum(s) for which validation
1072-
MUST be performed. The client MUST look for the HTTP header in the response as
1073-
per the :ref:`resolving checksum name <aws.protocols#httpChecksum-trait_resolving-checksum-name>`
1074-
section.
1088+
``responseAlgorithms`` property and filter it for the algorithms supported by
1089+
the client to look up the checksum(s) for which validation MUST be performed.
1090+
The client MUST look for the HTTP header in the response as per the
1091+
:ref:`resolving checksum name <aws.protocols#httpChecksum-trait_resolving-checksum-name>`
1092+
section. From the available headers in the response, the client MUST pick only
1093+
one checksum to validate.
10751094

10761095
A client MUST raise an error if the response checksum to validate does not
10771096
match computed checksum of the response payload for the same checksum algorithm.
@@ -1098,7 +1117,12 @@ property are set, the service MUST validate an HTTP request checksum.
10981117
When a service receives a request where the ``requestAlgorithmMember`` is set,
10991118
the service MUST look up the input member represented by the checksum
11001119
``requestAlgorithmMember`` property. The value of this member is the checksum
1101-
algorithm that the service MUST use to compute a checksum of the request payload.
1120+
algorithm that the service MUST use to compute a checksum of the request
1121+
payload. If the value of this member is not set, the service MUST look for the
1122+
HTTP headers in the request as per the
1123+
:ref:`resolving checksum name <aws.protocols#httpChecksum-trait_resolving-checksum-name>`
1124+
section. From the available headers in the request, the service MUST pick only
1125+
one checksum to validate.
11021126

11031127
The computed checksum MUST be validated against the checksum supplied at a
11041128
resolved location as per the :ref:`resolving checksum location
@@ -1114,7 +1138,7 @@ header.
11141138
When using the ``httpChecksum`` trait, services MUST always accept checksum
11151139
values in HTTP headers. For operations with streaming payload input, services
11161140
MUST additionally accept checksum values sent in the `chunked trailer part`_ of
1117-
the request body. Service MUST only send response checksums in HTTP headers.
1141+
the request body.
11181142

11191143
HTTP response checksums
11201144
-----------------------

0 commit comments

Comments
 (0)