Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changes/1021e75a-45f3-4f3a-820c-700d9ec6e782.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changes/4820850c-8916-47f5-a7e1-8880e6a00d22.json

This file was deleted.

5 changes: 5 additions & 0 deletions .changes/4855cecf-6a96-4622-b7ff-5d09e54f6564.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "4855cecf-6a96-4622-b7ff-5d09e54f6564",
"type": "bugfix",
"description": "Overwrite `Content-Length` header rather than appending in `CrtHttpEngine`"
}
5 changes: 0 additions & 5 deletions .changes/7e4f8c08-941c-4ea5-91b3-4c284746c453.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changes/c0040355-ffdc-4813-80e9-baf859ef02b9.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changes/d3ce7511-6fb2-4435-8f46-db724551b384.json

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/api-compat-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- main
- '*-main'

permissions: { }

jobs:
api-compat-verification:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ permissions:
id-token: write

on:
pull_request_target:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches:
- main
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
pull_request:
workflow_dispatch:

permissions: { }

# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
concurrency:
group: ci-pr-${{ github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/issue-regression-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: issue-regression-label
on:
issues:
types: [opened, edited]
permissions: { }
jobs:
add-regression-label:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: JReleaser check
on:
pull_request:

permissions: { }
jobs:
jreleaser-check:
permissions: {}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- '*-main'
workflow_dispatch:

permissions: { }

env:
PACKAGE_NAME: smithy-kotlin

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches: [ main ]
workflow_dispatch:

permissions: { }
jobs:
merge:
runs-on: ubuntu-latest
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/minor-version-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Minor version bump check
on:
pull_request:
permissions: { }
jobs:
minor-version-bump-check:
permissions: {}
runs-on: ubuntu-latest
steps:
- name: Minor version bump check
uses: awslabs/aws-kotlin-repo-tools/.github/actions/minor-version-bump@main
2 changes: 2 additions & 0 deletions .github/workflows/release-readiness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches: [ main ]

permissions: { }

jobs:
release-readiness:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ready-for-release') }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/stale_issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
schedule:
- cron: "0 0/3 * * *"

permissions: { }

jobs:
cleanup:
name: Stale issue job
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sync-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [ main ]
workflow_dispatch:

permissions: { }

jobs:
git-sync:
# Only sync when pushing to source repo
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [1.5.10] - 09/22/2025

### Documentation
* Improve documentation for [`StandardRetryPolicy`](https://docs.aws.amazon.com/smithy-kotlin/api/latest/runtime-core/aws.smithy.kotlin.runtime.retries.policy/-standard-retry-policy/)

## [1.5.8] - 09/04/2025

## [1.5.7] - 09/04/2025
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import aws.sdk.kotlin.gradle.dsl.configureJReleaser
import aws.sdk.kotlin.gradle.dsl.configureLinting
import aws.sdk.kotlin.gradle.dsl.configureMinorVersionStrategyRules
import aws.sdk.kotlin.gradle.util.typedProp
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand Down Expand Up @@ -109,6 +110,7 @@ val lintPaths = listOf(
)

configureLinting(lintPaths)
configureMinorVersionStrategyRules(lintPaths)

// Binary compatibility
apiValidation {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G

# SDK
sdkVersion=1.5.9-SNAPSHOT
sdkVersion=1.5.11-SNAPSHOT

# codegen
codegenVersion=0.35.9-SNAPSHOT
codegenVersion=0.35.11-SNAPSHOT

# FIXME Remove after Dokka 2.0 Gradle plugin is stable
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kotlin-version = "2.2.0"
dokka-version = "2.0.0"

aws-kotlin-repo-tools-version = "0.4.56"
aws-kotlin-repo-tools-version = "0.4.57"

# libs
coroutines-version = "1.10.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ package aws.smithy.kotlin.runtime.crt

import aws.sdk.kotlin.crt.io.MutableBuffer
import aws.smithy.kotlin.runtime.io.SdkBuffer
import aws.smithy.kotlin.runtime.io.read

internal actual fun transferRequestBody(outgoing: SdkBuffer, dest: MutableBuffer) = outgoing.read(dest.buffer)
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal fun HttpRequest.toCrtRequest(callContext: CoroutineContext): aws.sdk.ko
}

val contentLength = body.contentLength?.takeIf { it >= 0 }?.toString() ?: headers[CONTENT_LENGTH_HEADER]
contentLength?.let { crtHeaders.append(CONTENT_LENGTH_HEADER, it) }
contentLength?.let { crtHeaders[CONTENT_LENGTH_HEADER] = it }

return aws.sdk.kotlin.crt.http.HttpRequest(method.name, url.requestRelativePath, crtHeaders.build(), bodyStream)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
*/
package aws.smithy.kotlin.runtime.http.engine.crt

import aws.smithy.kotlin.runtime.content.ByteStream
import aws.smithy.kotlin.runtime.http.Headers
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.request.HttpRequest
import aws.smithy.kotlin.runtime.http.toHttpBody
import aws.smithy.kotlin.runtime.net.url.Url
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue

Expand Down Expand Up @@ -42,4 +50,19 @@ class RequestUtilTest {
assertFalse(isRetryable(code, name), "Expected $name to not be retryable!")
}
}

@Test
fun testContentLengthHeader() = runTest {
val data = "a".repeat(100)

val request = HttpRequest(
HttpMethod.POST,
url = Url.parse("https://notarealurl.com"),
headers = Headers { set("Content-Length", data.length.toString()) },
body = ByteStream.fromString(data).toHttpBody(),
)

val crtRequest = request.toCrtRequest(coroutineContext)
assertEquals(listOf(data.length.toString()), crtRequest.headers.getAll("Content-Length"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package aws.smithy.kotlin.runtime.http.engine.okhttp

import aws.smithy.kotlin.runtime.content.ByteStream
import aws.smithy.kotlin.runtime.http.*
import aws.smithy.kotlin.runtime.http.engine.internal.HttpClientMetrics
import aws.smithy.kotlin.runtime.http.request.HttpRequest
Expand Down Expand Up @@ -71,6 +72,22 @@ class OkHttpRequestTest {
assertEquals(listOf("bar", "baz"), actual.headers("FoO"))
}

@Test
fun itConvertsContentLengthHeader() {
val data = "a".repeat(100)
val url = Url.parse("https://aws.amazon.com")
val headers = Headers {
append("Content-Length", data.length.toString())
}
val request = HttpRequest(HttpMethod.POST, url, headers, ByteStream.fromString(data).toHttpBody())

val execContext = ExecutionContext()
val actual = request.toOkHttpRequest(execContext, EmptyCoroutineContext, testMetrics)

assertTrue(actual.headers.size >= 1)
assertEquals(listOf(data.length.toString()), actual.headers("Content-Length"))
}

@Test
fun itSupportsNonAsciiHeaderValues() {
val url = Url.parse("https://aws.amazon.com")
Expand Down
24 changes: 17 additions & 7 deletions runtime/runtime-core/api/runtime-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public abstract interface annotation class aws/smithy/kotlin/runtime/IgnoreNativ
public abstract interface annotation class aws/smithy/kotlin/runtime/InternalApi : java/lang/annotation/Annotation {
}

public abstract interface annotation class aws/smithy/kotlin/runtime/PlannedRemoval : java/lang/annotation/Annotation {
public abstract fun major ()I
public abstract fun minor ()I
}

public abstract interface class aws/smithy/kotlin/runtime/ProtocolResponse {
public abstract fun getSummary ()Ljava/lang/String;
}
Expand Down Expand Up @@ -391,6 +396,7 @@ public final class aws/smithy/kotlin/runtime/content/BigDecimal : java/lang/Numb
public final fun floatValue ()F
public final fun getExponent ()I
public final fun getMantissa ()Laws/smithy/kotlin/runtime/content/BigInteger;
public final fun getValue ()Ljava/lang/String;
public fun hashCode ()I
public final fun intValue ()I
public final fun longValue ()J
Expand All @@ -416,6 +422,7 @@ public final class aws/smithy/kotlin/runtime/content/BigInteger : java/lang/Numb
public final fun doubleValue ()D
public fun equals (Ljava/lang/Object;)Z
public final fun floatValue ()F
public final fun getValue ()Ljava/lang/String;
public fun hashCode ()I
public final fun intValue ()I
public final fun longValue ()J
Expand Down Expand Up @@ -864,10 +871,6 @@ public final class aws/smithy/kotlin/runtime/io/HashingSource : aws/smithy/kotli
}

public final class aws/smithy/kotlin/runtime/io/JavaIOKt {
public static final fun inputStream (Laws/smithy/kotlin/runtime/io/SdkBuffer;)Ljava/io/InputStream;
public static final fun isOpen (Laws/smithy/kotlin/runtime/io/SdkBuffer;)Z
public static final fun outputStream (Laws/smithy/kotlin/runtime/io/SdkBuffer;)Ljava/io/OutputStream;
public static final fun read (Laws/smithy/kotlin/runtime/io/SdkBuffer;Ljava/nio/ByteBuffer;)I
public static final fun sink (Ljava/io/File;)Laws/smithy/kotlin/runtime/io/SdkSink;
public static final fun sink (Ljava/io/OutputStream;)Laws/smithy/kotlin/runtime/io/SdkSink;
public static final fun sink (Ljava/nio/file/Path;)Laws/smithy/kotlin/runtime/io/SdkSink;
Expand All @@ -878,7 +881,6 @@ public final class aws/smithy/kotlin/runtime/io/JavaIOKt {
public static final fun source (Ljava/nio/file/Path;Lkotlin/ranges/LongRange;)Laws/smithy/kotlin/runtime/io/SdkSource;
public static synthetic fun source$default (Ljava/io/File;JJILjava/lang/Object;)Laws/smithy/kotlin/runtime/io/SdkSource;
public static synthetic fun source$default (Ljava/nio/file/Path;JJILjava/lang/Object;)Laws/smithy/kotlin/runtime/io/SdkSource;
public static final fun write (Laws/smithy/kotlin/runtime/io/SdkBuffer;Ljava/nio/ByteBuffer;)I
}

public final class aws/smithy/kotlin/runtime/io/SdkBuffer : aws/smithy/kotlin/runtime/io/SdkBufferedSink, aws/smithy/kotlin/runtime/io/SdkBufferedSource {
Expand All @@ -891,8 +893,12 @@ public final class aws/smithy/kotlin/runtime/io/SdkBuffer : aws/smithy/kotlin/ru
public fun getBuffer ()Laws/smithy/kotlin/runtime/io/SdkBuffer;
public final fun getSize ()J
public fun hashCode ()I
public fun inputStream ()Ljava/io/InputStream;
public fun isOpen ()Z
public fun outputStream ()Ljava/io/OutputStream;
public fun peek ()Laws/smithy/kotlin/runtime/io/SdkBufferedSource;
public fun read (Laws/smithy/kotlin/runtime/io/SdkBuffer;J)J
public fun read (Ljava/nio/ByteBuffer;)I
public fun read ([BII)I
public fun readAll (Laws/smithy/kotlin/runtime/io/SdkSink;)J
public fun readByte ()B
Expand All @@ -912,6 +918,7 @@ public final class aws/smithy/kotlin/runtime/io/SdkBuffer : aws/smithy/kotlin/ru
public fun toString ()Ljava/lang/String;
public fun write (Laws/smithy/kotlin/runtime/io/SdkBuffer;J)V
public fun write (Laws/smithy/kotlin/runtime/io/SdkSource;J)V
public fun write (Ljava/nio/ByteBuffer;)I
public fun write ([BII)V
public fun writeAll (Laws/smithy/kotlin/runtime/io/SdkSource;)J
public fun writeByte (B)V
Expand All @@ -924,9 +931,11 @@ public final class aws/smithy/kotlin/runtime/io/SdkBuffer : aws/smithy/kotlin/ru
public fun writeUtf8 (Ljava/lang/String;II)V
}

public abstract interface class aws/smithy/kotlin/runtime/io/SdkBufferedSink : aws/smithy/kotlin/runtime/io/SdkSink {
public abstract interface class aws/smithy/kotlin/runtime/io/SdkBufferedSink : aws/smithy/kotlin/runtime/io/SdkSink, java/nio/channels/WritableByteChannel {
public abstract fun emit ()V
public abstract fun flush ()V
public abstract fun getBuffer ()Laws/smithy/kotlin/runtime/io/SdkBuffer;
public abstract fun outputStream ()Ljava/io/OutputStream;
public abstract fun write (Laws/smithy/kotlin/runtime/io/SdkSource;J)V
public abstract fun write ([BII)V
public static synthetic fun write$default (Laws/smithy/kotlin/runtime/io/SdkBufferedSink;[BIIILjava/lang/Object;)V
Expand All @@ -947,9 +956,10 @@ public final class aws/smithy/kotlin/runtime/io/SdkBufferedSink$DefaultImpls {
public static synthetic fun writeUtf8$default (Laws/smithy/kotlin/runtime/io/SdkBufferedSink;Ljava/lang/String;IIILjava/lang/Object;)V
}

public abstract interface class aws/smithy/kotlin/runtime/io/SdkBufferedSource : aws/smithy/kotlin/runtime/io/SdkSource {
public abstract interface class aws/smithy/kotlin/runtime/io/SdkBufferedSource : aws/smithy/kotlin/runtime/io/SdkSource, java/nio/channels/ReadableByteChannel {
public abstract fun exhausted ()Z
public abstract fun getBuffer ()Laws/smithy/kotlin/runtime/io/SdkBuffer;
public abstract fun inputStream ()Ljava/io/InputStream;
public abstract fun peek ()Laws/smithy/kotlin/runtime/io/SdkBufferedSource;
public abstract fun read ([BII)I
public static synthetic fun read$default (Laws/smithy/kotlin/runtime/io/SdkBufferedSource;[BIIILjava/lang/Object;)I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ public annotation class ExperimentalApi
@DslMarker
public annotation class SdkDsl

/**
* Indicates that the annotated API is deprecated and scheduled for removal in an upcoming version.
* Any code using this API should migrate to the suggested replacement as soon as possible.
*/
@RequiresOptIn(
message = "This API is deprecated and scheduled for removal in an upcoming version.",
level = RequiresOptIn.Level.WARNING,
)
public annotation class PlannedRemoval(
val major: Int,
val minor: Int,
)

/**
* Marks a test that should be ignored on Native platforms
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public actual class BigDecimal private constructor(private val delegate: JvmBigD
public actual val exponent: Int
get() = delegate.scale()

public val value: String = delegate.toString()

public actual operator fun plus(other: BigDecimal): BigDecimal =
coalesceOrCreate(delegate + other.delegate, this, other)

Expand Down
Loading
Loading