Skip to content

Commit 3ac5065

Browse files
authored
Force TUNNEL proxy type in MQTT5 client (#399)
1 parent df8ef58 commit 3ac5065

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

source/v5/mqtt5_options_storage.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3825,8 +3825,9 @@ struct aws_mqtt5_client_options_storage *aws_mqtt5_client_options_storage_new(
38253825
}
38263826

38273827
if (options->http_proxy_options != NULL) {
3828+
/* Ignore a specified proxy connection type and use TUNNEL unconditionally as only this proxy type works. */
38283829
options_storage->http_proxy_config =
3829-
aws_http_proxy_config_new_from_proxy_options(allocator, options->http_proxy_options);
3830+
aws_http_proxy_config_new_tunneling_from_proxy_options(allocator, options->http_proxy_options);
38303831
if (options_storage->http_proxy_config == NULL) {
38313832
goto error;
38323833
}

tests/v5/mqtt5_operation_and_storage_tests.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3340,7 +3340,20 @@ static int s_mqtt5_client_options_set_invalid_proxy_fn(struct aws_allocator *all
33403340
struct aws_mqtt5_client_options_storage *client_options_storage =
33413341
aws_mqtt5_client_options_storage_new(allocator, &client_options);
33423342

3343-
ASSERT_NULL(client_options_storage);
3343+
/* Even though the provided proxy connection type is unsupported, MQTT5 client should ignore it and be initialized
3344+
* with TUNNEL. */
3345+
ASSERT_INT_EQUALS(AWS_HPCT_HTTP_TUNNEL, client_options_storage->http_proxy_options.connection_type);
3346+
3347+
ASSERT_INT_EQUALS(
3348+
AWS_MQTT5_DEFAULT_SOCKET_CONNECT_TIMEOUT_MS, client_options_storage->socket_options.connect_timeout_ms);
3349+
ASSERT_INT_EQUALS(AWS_MQTT5_CLIENT_DEFAULT_MIN_RECONNECT_DELAY_MS, client_options_storage->min_reconnect_delay_ms);
3350+
ASSERT_INT_EQUALS(AWS_MQTT5_CLIENT_DEFAULT_MAX_RECONNECT_DELAY_MS, client_options_storage->max_reconnect_delay_ms);
3351+
ASSERT_INT_EQUALS(
3352+
AWS_MQTT5_CLIENT_DEFAULT_MIN_CONNECTED_TIME_TO_RESET_RECONNECT_DELAY_MS,
3353+
client_options_storage->min_connected_time_to_reset_reconnect_delay_ms);
3354+
ASSERT_INT_EQUALS(AWS_MQTT5_CLIENT_DEFAULT_PING_TIMEOUT_MS, client_options_storage->ping_timeout_ms);
3355+
ASSERT_INT_EQUALS(AWS_MQTT5_CLIENT_DEFAULT_CONNACK_TIMEOUT_MS, client_options_storage->connack_timeout_ms);
3356+
ASSERT_INT_EQUALS(AWS_MQTT5_CLIENT_DEFAULT_OPERATION_TIMEOUNT_SECONDS, client_options_storage->ack_timeout_seconds);
33443357

33453358
aws_mqtt5_client_options_storage_destroy(client_options_storage);
33463359
aws_client_bootstrap_release(bootstrap);

0 commit comments

Comments
 (0)