Skip to content

Commit 79016da

Browse files
authored
Fix initial settings for h2 (#513)
1 parent 6586c80 commit 79016da

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

source/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ int s_validate_http_client_connection_options(const struct aws_http_client_conne
963963
}
964964

965965
/* http2_options cannot be NULL here, calling function adds them if they were missing */
966-
if (options->http2_options->num_initial_settings > 0 && options->http2_options->initial_settings_array) {
966+
if (options->http2_options->num_initial_settings > 0 && !options->http2_options->initial_settings_array) {
967967
AWS_LOGF_ERROR(
968968
AWS_LS_HTTP_CONNECTION,
969969
"static: Invalid connection options, h2 settings count is non-zero but settings array is null");

tests/test_tls.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ static int s_test_tls_download_medium_file_general(
169169
struct test_ctx test;
170170
ASSERT_SUCCESS(s_test_ctx_init(allocator, &test, h2_required));
171171

172+
struct aws_http2_setting settings_array[] = {
173+
{.id = AWS_HTTP2_SETTINGS_ENABLE_PUSH, .value = 0},
174+
};
175+
176+
struct aws_http2_connection_options http2_options = {
177+
.initial_settings_array = settings_array,
178+
.num_initial_settings = AWS_ARRAY_SIZE(settings_array),
179+
};
180+
172181
struct aws_tls_connection_options tls_connection_options;
173182
aws_tls_connection_options_init_from_ctx(&tls_connection_options, test.tls_ctx);
174183
aws_tls_connection_options_set_server_name(
@@ -182,6 +191,7 @@ static int s_test_tls_download_medium_file_general(
182191
http_options.on_shutdown = s_on_connection_shutdown;
183192
http_options.socket_options = &socket_options;
184193
http_options.tls_options = &tls_connection_options;
194+
http_options.http2_options = &http2_options;
185195
http_options.user_data = &test;
186196

187197
ASSERT_SUCCESS(aws_http_client_connect(&http_options));

0 commit comments

Comments
 (0)