File tree Expand file tree Collapse file tree 5 files changed +18
-1
lines changed
common/src/aws/smithy/kotlin/runtime/auth/awssigning
src/aws/smithy/kotlin/runtime/http/auth
test/aws/smithy/kotlin/runtime/http/auth Expand file tree Collapse file tree 5 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "id" : " fb91506d-98b4-4344-bf8b-c1527afe002c" ,
3+ "type" : " feature" ,
4+ "description" : " Add `EnableAwsChunked` signing attribute"
5+ }
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ public final class aws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAlgorithm
5252public final class aws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAttributes {
5353 public static final field INSTANCE Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAttributes;
5454 public final fun getCredentialsProvider ()Laws/smithy/kotlin/runtime/collections/AttributeKey;
55+ public final fun getEnableAwsChunked ()Laws/smithy/kotlin/runtime/collections/AttributeKey;
5556 public final fun getHashSpecification ()Laws/smithy/kotlin/runtime/collections/AttributeKey;
5657 public final fun getNormalizeUriPath ()Laws/smithy/kotlin/runtime/collections/AttributeKey;
5758 public final fun getRequestSignature ()Laws/smithy/kotlin/runtime/collections/AttributeKey;
Original file line number Diff line number Diff line change @@ -78,4 +78,12 @@ public object AwsSigningAttributes {
7878 * Flag indicating whether to normalize the URI path. See [AwsSigningConfig.normalizeUriPath] for more details.
7979 */
8080 public val NormalizeUriPath : AttributeKey <Boolean > = AttributeKey (" aws.smithy.kotlin.signing#NormalizeUriPath" )
81+
82+ /* *
83+ * Flag indicating whether to enable sending requests with `aws-chunked` content encoding. Defaults to `false`.
84+ * Note: This flag does not solely control aws-chunked behavior. The size of the request body must also be above a
85+ * defined threshold in order to be chunked.
86+ * @see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html">SigV4 Streaming</a>
87+ */
88+ public val EnableAwsChunked : AttributeKey <Boolean > = AttributeKey (" aws.smithy.kotlin.signing#EnableAwsChunked" )
8189}
Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ public class AwsHttpSigner(private val config: Config) : HttpSigner {
125125 val contextNormalizeUriPath = attributes.getOrNull(AwsSigningAttributes .NormalizeUriPath )
126126 val contextSigningServiceName = attributes.getOrNull(AwsSigningAttributes .SigningService )
127127
128+ val enableAwsChunked = attributes.getOrNull(AwsSigningAttributes .EnableAwsChunked ) ? : false
129+
128130 // operation signing config is baseConfig + operation specific config/overrides
129131 val signingConfig = AwsSigningConfig {
130132 service = contextSigningServiceName ? : checkNotNull(config.service)
@@ -156,7 +158,7 @@ public class AwsHttpSigner(private val config: Config) : HttpSigner {
156158 hashSpecification = when {
157159 contextHashSpecification != null -> contextHashSpecification
158160 body is HttpBody .Empty -> HashSpecification .EmptyBody
159- body.isEligibleForAwsChunkedStreaming -> {
161+ body.isEligibleForAwsChunkedStreaming && enableAwsChunked -> {
160162 if (request.headers.contains(" x-amz-trailer" )) {
161163 if (config.isUnsignedPayload) HashSpecification .StreamingUnsignedPayloadWithTrailers else HashSpecification .StreamingAws4HmacSha256PayloadWithTrailers
162164 } else {
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ public abstract class AwsHttpSignerTestBase(
7777 set(AwsSigningAttributes .SigningRegion , " us-east-1" )
7878 set(AwsSigningAttributes .SigningDate , Instant .fromIso8601(" 2020-10-16T19:56:00Z" ))
7979 set(AwsSigningAttributes .SigningService , " demo" )
80+ set(AwsSigningAttributes .EnableAwsChunked , true )
8081 }
8182 }
8283
You can’t perform that action at this time.
0 commit comments