Skip to content

Commit 9af3207

Browse files
committed
Init tls options only once
1 parent 46eb0f0 commit 9af3207

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/native/tls_context_options.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ jlong JNICALL Java_software_amazon_awssdk_crt_io_TlsContextOptions_tlsContextOpt
9999
struct aws_allocator *allocator = aws_jni_get_allocator();
100100
struct jni_tls_ctx_options *tls = aws_mem_calloc(allocator, 1, sizeof(struct jni_tls_ctx_options));
101101
AWS_FATAL_ASSERT(tls);
102-
aws_tls_ctx_options_init_default_client(&tls->options, allocator);
103102

104103
/* Certs or paths will cause an init, which overwrites other fields, so do those first */
105104
if (jni_certificate && jni_private_key) {
@@ -257,6 +256,9 @@ jlong JNICALL Java_software_amazon_awssdk_crt_io_TlsContextOptions_tlsContextOpt
257256
aws_jni_throw_runtime_exception(env, "aws_tls_ctx_options_init_client_mtls_from_system_path failed");
258257
goto on_error;
259258
}
259+
} else {
260+
/* no mTLS */
261+
aws_tls_ctx_options_init_default_client(&tls->options, allocator);
260262
}
261263

262264
if (jni_ca) {

0 commit comments

Comments
 (0)