From d8fcb1c048cf59de3fc3612f4231116351bb5621 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 22 Aug 2022 09:11:56 -0700 Subject: [PATCH 01/33] Exposes proxy options --- include/aws/s3/private/s3_client_impl.h | 16 ++++++++++++++++ include/aws/s3/private/s3_meta_request_impl.h | 2 +- include/aws/s3/s3_client.h | 14 ++++++++++++++ source/s3_auto_ranged_get.c | 2 +- source/s3_client.c | 11 ++++++++++- source/s3_endpoint.c | 15 +++++++++++---- 6 files changed, 53 insertions(+), 7 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 18de331e6..8901c6ef6 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -58,6 +58,14 @@ struct aws_s3_endpoint_options { /* HTTP port override. If zero, determine port based on TLS context */ uint16_t port; + + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct aws_http_proxy_options *proxy_options; }; struct aws_s3_endpoint { @@ -183,6 +191,14 @@ struct aws_s3_client { aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct aws_http_proxy_options *proxy_options; + struct { /* Number of overall requests currently being processed by the client. */ struct aws_atomic_var num_requests_in_flight; diff --git a/include/aws/s3/private/s3_meta_request_impl.h b/include/aws/s3/private/s3_meta_request_impl.h index d7940cdd9..e4031fe2f 100644 --- a/include/aws/s3/private/s3_meta_request_impl.h +++ b/include/aws/s3/private/s3_meta_request_impl.h @@ -51,7 +51,7 @@ struct aws_s3_prepare_request_payload { }; struct aws_s3_meta_request_vtable { - /* Update the meta request. out_request is required to be non-null. Returns true if there is there is any work in + /* Update the meta request. out_request is required to be non-null. Returns true if there is any work in * progress, false if there is not. */ bool (*update)(struct aws_s3_meta_request *meta_request, uint32_t flags, struct aws_s3_request **out_request); diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index e10854bdc..ed3d1030c 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -200,6 +200,20 @@ struct aws_s3_client_config { /* Callback and associated user data for when the client has completed its shutdown process. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; + + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct aws_http_proxy_options *proxy_options; + + // /** + // * Optional. + // * Proxy configuration for http connection. + // */ + // struct proxy_env_var_settings *proxy_ev_settings; }; /* Options for a new meta request, ie, file transfer that will be handled by the high performance client. */ diff --git a/source/s3_auto_ranged_get.c b/source/s3_auto_ranged_get.c index 338135333..b4782f635 100644 --- a/source/s3_auto_ranged_get.c +++ b/source/s3_auto_ranged_get.c @@ -135,7 +135,7 @@ static bool s_s3_auto_ranged_get_update( { aws_s3_meta_request_lock_synced_data(meta_request); - /* If nothing has set the the "finish result" then this meta request is still in progress and we can potentially + /* If nothing has set the "finish result" then this meta request is still in progress, and we can potentially * send additional requests. */ if (!aws_s3_meta_request_has_finish_result_synced(meta_request)) { diff --git a/source/s3_client.c b/source/s3_client.c index 81f82d96c..bde925528 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -288,6 +288,15 @@ struct aws_s3_client *aws_s3_client_new( /* Make a copy of the region string. */ client->region = aws_string_new_from_array(allocator, client_config->region.ptr, client_config->region.len); + if (client_config->proxy_options != NULL) { + client->proxy_options = aws_mem_calloc(client->allocator, 1, sizeof(struct aws_http_proxy_options)); + // TODO: aws_proxy_options_copy(client->proxy_options, client_config->pro); + // TODO: deep copy + // TODO: What about clean up? + } else { + client->proxy_options = NULL; + } + if (client_config->part_size != 0) { *((size_t *)&client->part_size) = client_config->part_size; } else { @@ -667,7 +676,6 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( struct aws_hash_element *endpoint_hash_element = NULL; int was_created = 0; - if (aws_hash_table_create( &client->synced_data.endpoints, endpoint_host_name, &endpoint_hash_element, &was_created)) { error_occurred = true; @@ -684,6 +692,7 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .user_data = client, .max_connections = aws_s3_client_get_max_active_connections(client, NULL), .port = port, + .proxy_options = client->proxy_options, }; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 8acf879ed..1d6b72d42 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -51,7 +51,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ struct aws_client_bootstrap *client_bootstrap, const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, - uint16_t port); + uint16_t port, + const struct aws_http_proxy_options *proxy_options); static void s_s3_endpoint_http_connection_manager_shutdown_callback(void *user_data); @@ -98,7 +99,8 @@ struct aws_s3_endpoint *aws_s3_endpoint_new( options->client_bootstrap, options->tls_connection_options, options->max_connections, - options->port); + options->port, + options->proxy_options); if (endpoint->http_connection_manager == NULL) { goto error_cleanup; @@ -124,13 +126,14 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ struct aws_client_bootstrap *client_bootstrap, const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, - uint16_t port) { + uint16_t port, + const struct aws_http_proxy_options *proxy_options +) { AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); AWS_PRECONDITION(host_name); struct aws_byte_cursor host_name_cursor = aws_byte_cursor_from_string(host_name); - /* Try to set up an HTTP connection manager. */ struct aws_socket_options socket_options; AWS_ZERO_STRUCT(socket_options); @@ -153,6 +156,10 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ manager_options.shutdown_complete_user_data = endpoint; manager_options.proxy_ev_settings = &proxy_ev_settings; + if (proxy_options != NULL) { + manager_options.proxy_options = proxy_options; + } + struct aws_tls_connection_options *manager_tls_options = NULL; if (tls_connection_options != NULL) { From 89cca7ebd539ca835be70d54bf290775fd7bcb90 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 22 Aug 2022 09:15:09 -0700 Subject: [PATCH 02/33] lint fix --- source/s3_endpoint.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 1d6b72d42..6fe535b57 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -127,8 +127,7 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, uint16_t port, - const struct aws_http_proxy_options *proxy_options -) { + const struct aws_http_proxy_options *proxy_options) { AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); AWS_PRECONDITION(host_name); From 4feb6313e4a9e591549874e56d6a953286cf1c95 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 22 Aug 2022 09:59:17 -0700 Subject: [PATCH 03/33] Fix comments --- include/aws/s3/private/s3_client_impl.h | 12 ++++-------- include/aws/s3/s3_client.h | 12 ++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 8901c6ef6..626717805 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -59,11 +59,9 @@ struct aws_s3_endpoint_options { /* HTTP port override. If zero, determine port based on TLS context */ uint16_t port; - /* + /** * Optional. - * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. + * Proxy configuration for http connection. */ struct aws_http_proxy_options *proxy_options; }; @@ -191,11 +189,9 @@ struct aws_s3_client { aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; - /* + /** * Optional. - * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. + * Proxy configuration for http connection. */ struct aws_http_proxy_options *proxy_options; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index ed3d1030c..b59b87e95 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -201,18 +201,18 @@ struct aws_s3_client_config { aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; + /** + * Optional. + * Proxy configuration for http connection. + */ + struct aws_http_proxy_options *proxy_options; + /* * Optional. * Configuration for using proxy from environment variable. * Defaults to true * Only works when proxy_options is not set. */ - struct aws_http_proxy_options *proxy_options; - - // /** - // * Optional. - // * Proxy configuration for http connection. - // */ // struct proxy_env_var_settings *proxy_ev_settings; }; From cbf8f52608082c485dc67091f911d393339ad192 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Wed, 24 Aug 2022 16:11:27 -0700 Subject: [PATCH 04/33] Move proxy option to meta request options --- include/aws/s3/s3_client.h | 12 ++++++------ source/s3_client.c | 11 +---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index b59b87e95..32bb1259d 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -201,12 +201,6 @@ struct aws_s3_client_config { aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; - /** - * Optional. - * Proxy configuration for http connection. - */ - struct aws_http_proxy_options *proxy_options; - /* * Optional. * Configuration for using proxy from environment variable. @@ -304,6 +298,12 @@ struct aws_s3_meta_request_options { * from the buffer and compare them them to previously uploaded part checksums. */ const struct aws_byte_cursor *resume_token; + + /** + * Optional. + * Proxy configuration for http connection. + */ + struct aws_http_proxy_options *proxy_options; }; /* Result details of a meta request. diff --git a/source/s3_client.c b/source/s3_client.c index bde925528..c3f13933a 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -288,15 +288,6 @@ struct aws_s3_client *aws_s3_client_new( /* Make a copy of the region string. */ client->region = aws_string_new_from_array(allocator, client_config->region.ptr, client_config->region.len); - if (client_config->proxy_options != NULL) { - client->proxy_options = aws_mem_calloc(client->allocator, 1, sizeof(struct aws_http_proxy_options)); - // TODO: aws_proxy_options_copy(client->proxy_options, client_config->pro); - // TODO: deep copy - // TODO: What about clean up? - } else { - client->proxy_options = NULL; - } - if (client_config->part_size != 0) { *((size_t *)&client->part_size) = client_config->part_size; } else { @@ -692,7 +683,7 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .user_data = client, .max_connections = aws_s3_client_get_max_active_connections(client, NULL), .port = port, - .proxy_options = client->proxy_options, + .proxy_options = options->proxy_options, }; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); From 4685e9d9aed11d110a99cd20a97b95952bbb636c Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Wed, 24 Aug 2022 16:13:56 -0700 Subject: [PATCH 05/33] remove proxy options from client --- include/aws/s3/private/s3_client_impl.h | 6 ------ include/aws/s3/s3_client.h | 8 -------- 2 files changed, 14 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 626717805..c58cd6aa7 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -189,12 +189,6 @@ struct aws_s3_client { aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; - /** - * Optional. - * Proxy configuration for http connection. - */ - struct aws_http_proxy_options *proxy_options; - struct { /* Number of overall requests currently being processed by the client. */ struct aws_atomic_var num_requests_in_flight; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 32bb1259d..64db12ff2 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -200,14 +200,6 @@ struct aws_s3_client_config { /* Callback and associated user data for when the client has completed its shutdown process. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; - - /* - * Optional. - * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. - */ - // struct proxy_env_var_settings *proxy_ev_settings; }; /* Options for a new meta request, ie, file transfer that will be handled by the high performance client. */ From 2c2fddb6c5535974330288b5a8fc8adbc5c6c9e3 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Thu, 25 Aug 2022 10:02:47 -0700 Subject: [PATCH 06/33] Expose proxy_ev_settings --- include/aws/s3/private/s3_client_impl.h | 8 ++++++++ include/aws/s3/s3_client.h | 8 ++++++++ source/s3_client.c | 1 + source/s3_endpoint.c | 26 ++++++++++++++----------- tests/s3_retry_tests.c | 2 -- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index c58cd6aa7..1c0a55898 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -64,6 +64,14 @@ struct aws_s3_endpoint_options { * Proxy configuration for http connection. */ struct aws_http_proxy_options *proxy_options; + + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct proxy_env_var_settings *proxy_ev_settings; }; struct aws_s3_endpoint { diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 64db12ff2..508165575 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -296,6 +296,14 @@ struct aws_s3_meta_request_options { * Proxy configuration for http connection. */ struct aws_http_proxy_options *proxy_options; + + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct proxy_env_var_settings *proxy_ev_settings; }; /* Result details of a meta request. diff --git a/source/s3_client.c b/source/s3_client.c index c3f13933a..a97b7770f 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -684,6 +684,7 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .max_connections = aws_s3_client_get_max_active_connections(client, NULL), .port = port, .proxy_options = options->proxy_options, + .proxy_ev_settings = options->proxy_ev_settings, }; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 6fe535b57..017119e9c 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -52,7 +52,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, uint16_t port, - const struct aws_http_proxy_options *proxy_options); + const struct aws_http_proxy_options *proxy_options, + const struct proxy_env_var_settings *proxy_ev_settings); static void s_s3_endpoint_http_connection_manager_shutdown_callback(void *user_data); @@ -100,7 +101,8 @@ struct aws_s3_endpoint *aws_s3_endpoint_new( options->tls_connection_options, options->max_connections, options->port, - options->proxy_options); + options->proxy_options, + options->proxy_ev_settings); if (endpoint->http_connection_manager == NULL) { goto error_cleanup; @@ -127,7 +129,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, uint16_t port, - const struct aws_http_proxy_options *proxy_options) { + const struct aws_http_proxy_options *proxy_options, + const struct proxy_env_var_settings *proxy_ev_settings) { AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); AWS_PRECONDITION(host_name); @@ -139,10 +142,14 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ socket_options.type = AWS_SOCKET_STREAM; socket_options.domain = AWS_SOCKET_IPV4; socket_options.connect_timeout_ms = s_connection_timeout_ms; - struct proxy_env_var_settings proxy_ev_settings; - AWS_ZERO_STRUCT(proxy_ev_settings); + /* Turn on envrionment variable for proxy by default */ - proxy_ev_settings.env_var_type = AWS_HPEV_ENABLE; + if (proxy_ev_settings == NULL) { + struct proxy_env_var_settings proxy_ev_settings_default; + AWS_ZERO_STRUCT(proxy_ev_settings_default); + proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; + proxy_ev_settings = &proxy_ev_settings_default; + } struct aws_http_connection_manager_options manager_options; AWS_ZERO_STRUCT(manager_options); @@ -153,11 +160,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ manager_options.max_connections = max_connections; manager_options.shutdown_complete_callback = s_s3_endpoint_http_connection_manager_shutdown_callback; manager_options.shutdown_complete_user_data = endpoint; - manager_options.proxy_ev_settings = &proxy_ev_settings; - - if (proxy_options != NULL) { - manager_options.proxy_options = proxy_options; - } + manager_options.proxy_ev_settings = proxy_ev_settings; + manager_options.proxy_options = proxy_options; struct aws_tls_connection_options *manager_tls_options = NULL; diff --git a/tests/s3_retry_tests.c b/tests/s3_retry_tests.c index 1df40df59..f75ffa2cc 100644 --- a/tests/s3_retry_tests.c +++ b/tests/s3_retry_tests.c @@ -115,8 +115,6 @@ static int s_test_s3_client_acquire_connection_fail(struct aws_allocator *alloca aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); - - return 0; } struct s3_fail_prepare_test_data { From 4cabcb3ad91a7dde2968c6fde8cc368c8c120ad0 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Thu, 25 Aug 2022 11:30:49 -0700 Subject: [PATCH 07/33] fix test --- tests/s3_retry_tests.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/s3_retry_tests.c b/tests/s3_retry_tests.c index f75ffa2cc..1df40df59 100644 --- a/tests/s3_retry_tests.c +++ b/tests/s3_retry_tests.c @@ -115,6 +115,8 @@ static int s_test_s3_client_acquire_connection_fail(struct aws_allocator *alloca aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); + + return 0; } struct s3_fail_prepare_test_data { From b4c1c151d974ccaab39bf54ca4b8b86310ea38b0 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Thu, 25 Aug 2022 11:40:30 -0700 Subject: [PATCH 08/33] Fix struct --- source/s3_endpoint.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 017119e9c..229bb314b 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -143,11 +143,11 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ socket_options.domain = AWS_SOCKET_IPV4; socket_options.connect_timeout_ms = s_connection_timeout_ms; + struct proxy_env_var_settings proxy_ev_settings_default; + AWS_ZERO_STRUCT(proxy_ev_settings_default); + proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; /* Turn on envrionment variable for proxy by default */ if (proxy_ev_settings == NULL) { - struct proxy_env_var_settings proxy_ev_settings_default; - AWS_ZERO_STRUCT(proxy_ev_settings_default); - proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; proxy_ev_settings = &proxy_ev_settings_default; } From 701b7216efa0a280fe0921df6685dc5db9a4bc73 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Thu, 25 Aug 2022 16:35:58 -0700 Subject: [PATCH 09/33] Expose keep alive & connect timeout --- include/aws/s3/private/s3_client_impl.h | 12 +++++++++++ include/aws/s3/s3_client.h | 28 +++++++++++++++++++++++++ source/s3_client.c | 3 ++- source/s3_endpoint.c | 19 +++++++++++++---- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 1c0a55898..a9467b736 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -72,6 +72,18 @@ struct aws_s3_endpoint_options { * Only works when proxy_options is not set. */ struct proxy_env_var_settings *proxy_ev_settings; + + /** + * Optional. + * If set to 0, default value is used. + */ + uint32_t connect_timeout_ms; + + /** + * Optional. + * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + */ + struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; }; struct aws_s3_endpoint { diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 508165575..715c8f618 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -202,6 +202,22 @@ struct aws_s3_client_config { void *shutdown_callback_user_data; }; +/* Keepalive properties are TCP only. + * If interval or timeout are zero, then default values are used. + */ +struct aws_s3_tcp_keep_alive_options { + + /* Set keepalive true to periodically transmit messages for detecting a disconnected peer.*/ + bool keepalive; + + uint16_t keep_alive_interval_sec; + uint16_t keep_alive_timeout_sec; + + /* If set, sets the number of keep alive probes allowed to fail before the connection is considered + * lost. If zero OS defaults are used. On Windows, this option is meaningless until Windows 10 1703.*/ + uint16_t keep_alive_max_failed_probes; +}; + /* Options for a new meta request, ie, file transfer that will be handled by the high performance client. */ struct aws_s3_meta_request_options { @@ -304,6 +320,18 @@ struct aws_s3_meta_request_options { * Only works when proxy_options is not set. */ struct proxy_env_var_settings *proxy_ev_settings; + + /** + * Optional. + * If set to 0, default value is used. + */ + uint32_t connect_timeout_ms; + + /* + * Optional. + * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + */ + struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; }; /* Result details of a meta request. diff --git a/source/s3_client.c b/source/s3_client.c index a97b7770f..ce59235cc 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -685,7 +685,8 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .port = port, .proxy_options = options->proxy_options, .proxy_ev_settings = options->proxy_ev_settings, - }; + .connect_timeout_ms = options->connect_timeout_ms, + .tcp_keep_alive_options = options->tcp_keep_alive_options}; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 229bb314b..f489e7960 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -53,7 +53,9 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ uint32_t max_connections, uint16_t port, const struct aws_http_proxy_options *proxy_options, - const struct proxy_env_var_settings *proxy_ev_settings); + const struct proxy_env_var_settings *proxy_ev_settings, + uint32_t connect_timeout_ms, + const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options); static void s_s3_endpoint_http_connection_manager_shutdown_callback(void *user_data); @@ -102,7 +104,9 @@ struct aws_s3_endpoint *aws_s3_endpoint_new( options->max_connections, options->port, options->proxy_options, - options->proxy_ev_settings); + options->proxy_ev_settings, + options->connect_timeout_ms, + options->tcp_keep_alive_options); if (endpoint->http_connection_manager == NULL) { goto error_cleanup; @@ -130,18 +134,25 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ uint32_t max_connections, uint16_t port, const struct aws_http_proxy_options *proxy_options, - const struct proxy_env_var_settings *proxy_ev_settings) { + const struct proxy_env_var_settings *proxy_ev_settings, + uint32_t connect_timeout_ms, + const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options) { AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); AWS_PRECONDITION(host_name); struct aws_byte_cursor host_name_cursor = aws_byte_cursor_from_string(host_name); /* Try to set up an HTTP connection manager. */ + struct aws_socket_options socket_options; AWS_ZERO_STRUCT(socket_options); socket_options.type = AWS_SOCKET_STREAM; socket_options.domain = AWS_SOCKET_IPV4; - socket_options.connect_timeout_ms = s_connection_timeout_ms; + socket_options.connect_timeout_ms = connect_timeout_ms == 0 ? s_connection_timeout_ms : connect_timeout_ms; + socket_options.keepalive = tcp_keep_alive_options.keepalive; + socket_options.keep_alive_interval_sec = tcp_keep_alive_options.keep_alive_interval_sec; + socket_options.keep_alive_timeout_sec = tcp_keep_alive_options.keep_alive_timeout_sec; + socket_options.keep_alive_max_failed_probes = tcp_keep_alive_options.keep_alive_max_failed_probes; struct proxy_env_var_settings proxy_ev_settings_default; AWS_ZERO_STRUCT(proxy_ev_settings_default); From 78b7939d930bdb756d080e5892be33cafaca667f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sat, 27 Aug 2022 20:13:19 -0700 Subject: [PATCH 10/33] Adds proxy config in S3 Client --- include/aws/s3/private/s3_client_impl.h | 8 +++++++- include/aws/s3/s3_client.h | 10 ++++++++-- source/s3_client.c | 19 ++++++++++++++++++- source/s3_endpoint.c | 17 ++++++++++++----- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index a9467b736..118aeb974 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -63,7 +63,7 @@ struct aws_s3_endpoint_options { * Optional. * Proxy configuration for http connection. */ - struct aws_http_proxy_options *proxy_options; + struct aws_http_proxy_config *proxy_config; /* * Optional. @@ -205,6 +205,12 @@ struct aws_s3_client { /* Retry strategy used for scheduling request retries. */ struct aws_retry_strategy *retry_strategy; + /** + * Optional. + * Proxy configuration for http connection. + */ + struct aws_http_proxy_config *proxy_config; + /* Shutdown callbacks to notify when the client is completely cleaned up. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 715c8f618..531be7ff8 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -6,11 +6,11 @@ * SPDX-License-Identifier: Apache-2.0. */ +#include +#include #include #include -#include - struct aws_allocator; struct aws_http_stream; @@ -200,6 +200,12 @@ struct aws_s3_client_config { /* Callback and associated user data for when the client has completed its shutdown process. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; + + /** + * Optional. + * Proxy configuration for http connection. + */ + struct aws_http_proxy_options *proxy_options; }; /* Keepalive properties are TCP only. diff --git a/source/s3_client.c b/source/s3_client.c index ce59235cc..2df510c33 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -304,6 +304,13 @@ struct aws_s3_client *aws_s3_client_new( *((size_t *)&client_config->max_part_size) = client_config->part_size; } + if (client_config->proxy_options) { + client->proxy_config = aws_http_proxy_config_new_from_proxy_options(allocator, client_config->proxy_options); + if (client->proxy_config == NULL) { + goto on_error; + } + } + if (client_config->tls_mode == AWS_MR_TLS_ENABLED) { client->tls_connection_options = aws_mem_calloc(client->allocator, 1, sizeof(struct aws_tls_connection_options)); @@ -421,6 +428,12 @@ struct aws_s3_client *aws_s3_client_new( aws_mem_release(client->allocator, client->tls_connection_options); client->tls_connection_options = NULL; } + if (client->proxy_config) { + aws_http_proxy_config_destroy(client->proxy_config); + } + + // Todo: clean proxy config + aws_event_loop_group_release(client->client_bootstrap->event_loop_group); aws_client_bootstrap_release(client->client_bootstrap); aws_mutex_clean_up(&client->synced_data.lock); @@ -495,6 +508,10 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { client->tls_connection_options = NULL; } + if (client->proxy_config) { + aws_http_proxy_config_destroy(client->proxy_config); + } + aws_mutex_clean_up(&client->synced_data.lock); AWS_ASSERT(aws_linked_list_empty(&client->synced_data.pending_meta_request_work)); @@ -683,7 +700,7 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .user_data = client, .max_connections = aws_s3_client_get_max_active_connections(client, NULL), .port = port, - .proxy_options = options->proxy_options, + .proxy_config = client->proxy_config, .proxy_ev_settings = options->proxy_ev_settings, .connect_timeout_ms = options->connect_timeout_ms, .tcp_keep_alive_options = options->tcp_keep_alive_options}; diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index f489e7960..d8724ca57 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include //Todo: maybe remove from here #include #include #include @@ -52,7 +52,7 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, uint16_t port, - const struct aws_http_proxy_options *proxy_options, + const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options); @@ -103,7 +103,7 @@ struct aws_s3_endpoint *aws_s3_endpoint_new( options->tls_connection_options, options->max_connections, options->port, - options->proxy_options, + options->proxy_config, options->proxy_ev_settings, options->connect_timeout_ms, options->tcp_keep_alive_options); @@ -133,10 +133,11 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_tls_connection_options *tls_connection_options, uint32_t max_connections, uint16_t port, - const struct aws_http_proxy_options *proxy_options, + const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options) { + AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); AWS_PRECONDITION(host_name); @@ -161,6 +162,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ if (proxy_ev_settings == NULL) { proxy_ev_settings = &proxy_ev_settings_default; } + socket_options.connect_timeout_ms = s_connection_timeout_ms; + struct aws_http_proxy_options *proxy_options; struct aws_http_connection_manager_options manager_options; AWS_ZERO_STRUCT(manager_options); @@ -172,7 +175,11 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ manager_options.shutdown_complete_callback = s_s3_endpoint_http_connection_manager_shutdown_callback; manager_options.shutdown_complete_user_data = endpoint; manager_options.proxy_ev_settings = proxy_ev_settings; - manager_options.proxy_options = proxy_options; + if (proxy_config != NULL) { + proxy_options = aws_mem_calloc(endpoint->allocator, 1, sizeof(struct aws_http_proxy_options)); + aws_http_proxy_options_init_from_config(proxy_options, proxy_config); + manager_options.proxy_options = proxy_options; + } struct aws_tls_connection_options *manager_tls_options = NULL; From f0ce0c112ea689748501a8817a942fffed2cbe17 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sat, 27 Aug 2022 21:17:49 -0700 Subject: [PATCH 11/33] Adds proxy environment, connect_timeout, and tcp keep alive options to S3 Client --- include/aws/s3/private/s3_client_impl.h | 20 +++++++ include/aws/s3/s3_client.h | 72 ++++++++++++------------- source/s3_client.c | 9 ++-- 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 118aeb974..1b118a813 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -211,6 +211,26 @@ struct aws_s3_client { */ struct aws_http_proxy_config *proxy_config; + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct proxy_env_var_settings *proxy_ev_settings; // Todo: update comment + + /** + * Optional. + * If set to 0, default value is used. + */ + uint32_t connect_timeout_ms; + + /* + * Optional. + * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + */ + struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + /* Shutdown callbacks to notify when the client is completely cleaned up. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 531be7ff8..1f85813db 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -150,6 +150,22 @@ enum aws_s3_checksum_algorithm { AWS_SCA_COUNT, }; +/* Keepalive properties are TCP only. + * If interval or timeout are zero, then default values are used. + */ +struct aws_s3_tcp_keep_alive_options { + + /* Set keepalive true to periodically transmit messages for detecting a disconnected peer.*/ + bool keepalive; // Todo: remove + + uint16_t keep_alive_interval_sec; + uint16_t keep_alive_timeout_sec; + + /* If set, sets the number of keep alive probes allowed to fail before the connection is considered + * lost. If zero OS defaults are used. On Windows, this option is meaningless until Windows 10 1703.*/ + uint16_t keep_alive_max_failed_probes; +}; + /* Options for a new client. */ struct aws_s3_client_config { @@ -206,22 +222,26 @@ struct aws_s3_client_config { * Proxy configuration for http connection. */ struct aws_http_proxy_options *proxy_options; -}; - -/* Keepalive properties are TCP only. - * If interval or timeout are zero, then default values are used. - */ -struct aws_s3_tcp_keep_alive_options { - /* Set keepalive true to periodically transmit messages for detecting a disconnected peer.*/ - bool keepalive; + /* + * Optional. + * Configuration for using proxy from environment variable. + * Defaults to true + * Only works when proxy_options is not set. + */ + struct proxy_env_var_settings *proxy_ev_settings; // Todo: update comment - uint16_t keep_alive_interval_sec; - uint16_t keep_alive_timeout_sec; + /** + * Optional. + * If set to 0, default value is used. + */ + uint32_t connect_timeout_ms; - /* If set, sets the number of keep alive probes allowed to fail before the connection is considered - * lost. If zero OS defaults are used. On Windows, this option is meaningless until Windows 10 1703.*/ - uint16_t keep_alive_max_failed_probes; + /* + * Optional. + * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + */ + struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; }; /* Options for a new meta request, ie, file transfer that will be handled by the high performance client. */ @@ -312,32 +332,6 @@ struct aws_s3_meta_request_options { * from the buffer and compare them them to previously uploaded part checksums. */ const struct aws_byte_cursor *resume_token; - - /** - * Optional. - * Proxy configuration for http connection. - */ - struct aws_http_proxy_options *proxy_options; - - /* - * Optional. - * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. - */ - struct proxy_env_var_settings *proxy_ev_settings; - - /** - * Optional. - * If set to 0, default value is used. - */ - uint32_t connect_timeout_ms; - - /* - * Optional. - * Set keepalive true to periodically transmit messages for detecting a disconnected peer. - */ - struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; }; /* Result details of a meta request. diff --git a/source/s3_client.c b/source/s3_client.c index 2df510c33..856d50f88 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -310,6 +310,9 @@ struct aws_s3_client *aws_s3_client_new( goto on_error; } } + client->connect_timeout_ms = client_config->connect_timeout_ms; + client->proxy_ev_settings = client_config->proxy_ev_settings; // Todo: deep copy + client->tcp_keep_alive_options = client_config->tcp_keep_alive_options; if (client_config->tls_mode == AWS_MR_TLS_ENABLED) { client->tls_connection_options = @@ -701,9 +704,9 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .max_connections = aws_s3_client_get_max_active_connections(client, NULL), .port = port, .proxy_config = client->proxy_config, - .proxy_ev_settings = options->proxy_ev_settings, - .connect_timeout_ms = options->connect_timeout_ms, - .tcp_keep_alive_options = options->tcp_keep_alive_options}; + .proxy_ev_settings = client->proxy_ev_settings, + .connect_timeout_ms = client->connect_timeout_ms, + .tcp_keep_alive_options = client->tcp_keep_alive_options}; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); From 348740599174bd98f1139b69002506c10f9d89ce Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sat, 27 Aug 2022 21:34:31 -0700 Subject: [PATCH 12/33] Deep copy proxy ev setting and destroy. --- source/s3_client.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/source/s3_client.c b/source/s3_client.c index 856d50f88..d87ea4161 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -312,6 +312,18 @@ struct aws_s3_client *aws_s3_client_new( } client->connect_timeout_ms = client_config->connect_timeout_ms; client->proxy_ev_settings = client_config->proxy_ev_settings; // Todo: deep copy + if (client_config->proxy_ev_settings) { + *client->proxy_ev_settings = *client_config->proxy_ev_settings; // shallow copy + if (client_config->proxy_ev_settings->tls_options) { + client->proxy_ev_settings->tls_options = + aws_mem_calloc(allocator, 1, sizeof(struct aws_tls_connection_options)); + if (aws_tls_connection_options_copy( + client->proxy_ev_settings->tls_options, client_config->proxy_ev_settings->tls_options)) { + goto on_error; + } + } + } + client->tcp_keep_alive_options = client_config->tcp_keep_alive_options; if (client_config->tls_mode == AWS_MR_TLS_ENABLED) { @@ -434,8 +446,12 @@ struct aws_s3_client *aws_s3_client_new( if (client->proxy_config) { aws_http_proxy_config_destroy(client->proxy_config); } - - // Todo: clean proxy config + if (client->proxy_ev_settings->tls_options) { + // Todo: need a null check for proxy_ev_settings? + aws_tls_connection_options_clean_up(client->proxy_ev_settings->tls_options); + aws_mem_release(client->allocator, client->proxy_ev_settings->tls_options); + client->proxy_ev_settings->tls_options = NULL; + } aws_event_loop_group_release(client->client_bootstrap->event_loop_group); aws_client_bootstrap_release(client->client_bootstrap); @@ -515,6 +531,13 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { aws_http_proxy_config_destroy(client->proxy_config); } + if (client->proxy_ev_settings->tls_options) { + // Todo: need a null check for proxy_ev_settings? + aws_tls_connection_options_clean_up(client->proxy_ev_settings->tls_options); + aws_mem_release(client->allocator, client->proxy_ev_settings->tls_options); + client->proxy_ev_settings->tls_options = NULL; + } + aws_mutex_clean_up(&client->synced_data.lock); AWS_ASSERT(aws_linked_list_empty(&client->synced_data.pending_meta_request_work)); From 756ac86f6c4814d302e349686ec87c1ba3818aa3 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sun, 28 Aug 2022 14:27:56 -0700 Subject: [PATCH 13/33] Fix const proxy environment tls config --- include/aws/s3/private/s3_client_impl.h | 2 ++ source/s3_client.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 1b118a813..33f6e8ff2 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -231,6 +231,8 @@ struct aws_s3_client { */ struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + struct aws_tls_connection_options *proxy_ev_tls_options; + /* Shutdown callbacks to notify when the client is completely cleaned up. */ aws_s3_client_shutdown_complete_callback_fn *shutdown_callback; void *shutdown_callback_user_data; diff --git a/source/s3_client.c b/source/s3_client.c index d87ea4161..0a1942969 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -314,13 +314,13 @@ struct aws_s3_client *aws_s3_client_new( client->proxy_ev_settings = client_config->proxy_ev_settings; // Todo: deep copy if (client_config->proxy_ev_settings) { *client->proxy_ev_settings = *client_config->proxy_ev_settings; // shallow copy + if (client_config->proxy_ev_settings->tls_options) { - client->proxy_ev_settings->tls_options = - aws_mem_calloc(allocator, 1, sizeof(struct aws_tls_connection_options)); - if (aws_tls_connection_options_copy( - client->proxy_ev_settings->tls_options, client_config->proxy_ev_settings->tls_options)) { + client->proxy_ev_tls_options = aws_mem_calloc(allocator, 1, sizeof(struct aws_tls_connection_options)); + if (aws_tls_connection_options_copy(client->proxy_ev_tls_options, client->proxy_ev_settings->tls_options)) { goto on_error; } + client->proxy_ev_settings->tls_options = client->proxy_ev_tls_options; } } @@ -448,8 +448,9 @@ struct aws_s3_client *aws_s3_client_new( } if (client->proxy_ev_settings->tls_options) { // Todo: need a null check for proxy_ev_settings? - aws_tls_connection_options_clean_up(client->proxy_ev_settings->tls_options); - aws_mem_release(client->allocator, client->proxy_ev_settings->tls_options); + // Todo: Why a constant and need for copying it somewhere else? + aws_tls_connection_options_clean_up(client->proxy_ev_tls_options); + aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; } @@ -533,8 +534,8 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { if (client->proxy_ev_settings->tls_options) { // Todo: need a null check for proxy_ev_settings? - aws_tls_connection_options_clean_up(client->proxy_ev_settings->tls_options); - aws_mem_release(client->allocator, client->proxy_ev_settings->tls_options); + aws_tls_connection_options_clean_up(client->proxy_ev_tls_options); + aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; } From c711e75d08294b527f2dd20d5acacb3ec100020f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sun, 28 Aug 2022 14:31:50 -0700 Subject: [PATCH 14/33] Fix todos --- source/s3_client.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/s3_client.c b/source/s3_client.c index 0a1942969..ed0f8389a 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -311,10 +311,10 @@ struct aws_s3_client *aws_s3_client_new( } } client->connect_timeout_ms = client_config->connect_timeout_ms; - client->proxy_ev_settings = client_config->proxy_ev_settings; // Todo: deep copy + client->proxy_ev_settings = client_config->proxy_ev_settings; if (client_config->proxy_ev_settings) { *client->proxy_ev_settings = *client_config->proxy_ev_settings; // shallow copy - + // Todo: Is there a better way to fix issues due to const proxy_ev_settings->tls_options? if (client_config->proxy_ev_settings->tls_options) { client->proxy_ev_tls_options = aws_mem_calloc(allocator, 1, sizeof(struct aws_tls_connection_options)); if (aws_tls_connection_options_copy(client->proxy_ev_tls_options, client->proxy_ev_settings->tls_options)) { @@ -447,8 +447,6 @@ struct aws_s3_client *aws_s3_client_new( aws_http_proxy_config_destroy(client->proxy_config); } if (client->proxy_ev_settings->tls_options) { - // Todo: need a null check for proxy_ev_settings? - // Todo: Why a constant and need for copying it somewhere else? aws_tls_connection_options_clean_up(client->proxy_ev_tls_options); aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; @@ -532,8 +530,7 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { aws_http_proxy_config_destroy(client->proxy_config); } - if (client->proxy_ev_settings->tls_options) { - // Todo: need a null check for proxy_ev_settings? + if (client->proxy_ev_tls_options) { aws_tls_connection_options_clean_up(client->proxy_ev_tls_options); aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; From 6951cc81d8e3f02d78ee2a27e2b2e9e99cea9aa9 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 09:01:05 -0700 Subject: [PATCH 15/33] updates comment --- include/aws/s3/private/s3_client_impl.h | 17 ++++++++++------- include/aws/s3/s3_client.h | 9 +++++---- source/s3_endpoint.c | 5 ++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 33f6e8ff2..ec2eb6498 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -68,14 +68,15 @@ struct aws_s3_endpoint_options { /* * Optional. * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. + * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy + * configuration from environment variables. + * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. */ struct proxy_env_var_settings *proxy_ev_settings; /** * Optional. - * If set to 0, default value is used. + * If set to 0, default value (3000) is used. */ uint32_t connect_timeout_ms; @@ -214,14 +215,15 @@ struct aws_s3_client { /* * Optional. * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. + * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy + * configuration from environment variables. + * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. */ - struct proxy_env_var_settings *proxy_ev_settings; // Todo: update comment + struct proxy_env_var_settings *proxy_ev_settings; /** * Optional. - * If set to 0, default value is used. + * If set to 0, default value (3000) is used. */ uint32_t connect_timeout_ms; @@ -231,6 +233,7 @@ struct aws_s3_client { */ struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + /* tls options from proxy environment settings. */ struct aws_tls_connection_options *proxy_ev_tls_options; /* Shutdown callbacks to notify when the client is completely cleaned up. */ diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 1f85813db..5a5fcff2e 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -226,14 +226,15 @@ struct aws_s3_client_config { /* * Optional. * Configuration for using proxy from environment variable. - * Defaults to true - * Only works when proxy_options is not set. + * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy + * configuration from environment variables. + * Only works when proxy_options is not set. If both are set, configuration from proxy_options is used. */ - struct proxy_env_var_settings *proxy_ev_settings; // Todo: update comment + struct proxy_env_var_settings *proxy_ev_settings; /** * Optional. - * If set to 0, default value is used. + * If set to 0, default value (3000) is used. */ uint32_t connect_timeout_ms; diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index d8724ca57..6388ffc75 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -154,12 +154,11 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ socket_options.keep_alive_interval_sec = tcp_keep_alive_options.keep_alive_interval_sec; socket_options.keep_alive_timeout_sec = tcp_keep_alive_options.keep_alive_timeout_sec; socket_options.keep_alive_max_failed_probes = tcp_keep_alive_options.keep_alive_max_failed_probes; - struct proxy_env_var_settings proxy_ev_settings_default; - AWS_ZERO_STRUCT(proxy_ev_settings_default); - proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; /* Turn on envrionment variable for proxy by default */ if (proxy_ev_settings == NULL) { + AWS_ZERO_STRUCT(proxy_ev_settings_default); + proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; proxy_ev_settings = &proxy_ev_settings_default; } socket_options.connect_timeout_ms = s_connection_timeout_ms; From 5232a375da0da0f68e1c32f34930afdb10526986 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 09:57:55 -0700 Subject: [PATCH 16/33] Fix proxy ev settings allocation and clean up --- include/aws/s3/s3_client.h | 2 +- source/s3_client.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 5a5fcff2e..4b3571a23 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -156,7 +156,7 @@ enum aws_s3_checksum_algorithm { struct aws_s3_tcp_keep_alive_options { /* Set keepalive true to periodically transmit messages for detecting a disconnected peer.*/ - bool keepalive; // Todo: remove + bool keepalive; uint16_t keep_alive_interval_sec; uint16_t keep_alive_timeout_sec; diff --git a/source/s3_client.c b/source/s3_client.c index ed0f8389a..2bee66d0b 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -311,10 +311,10 @@ struct aws_s3_client *aws_s3_client_new( } } client->connect_timeout_ms = client_config->connect_timeout_ms; - client->proxy_ev_settings = client_config->proxy_ev_settings; if (client_config->proxy_ev_settings) { - *client->proxy_ev_settings = *client_config->proxy_ev_settings; // shallow copy - // Todo: Is there a better way to fix issues due to const proxy_ev_settings->tls_options? + client->proxy_ev_settings = aws_mem_calloc(allocator, 1, sizeof(struct proxy_env_var_settings)); + *client->proxy_ev_settings = *client_config->proxy_ev_settings; + if (client_config->proxy_ev_settings->tls_options) { client->proxy_ev_tls_options = aws_mem_calloc(allocator, 1, sizeof(struct aws_tls_connection_options)); if (aws_tls_connection_options_copy(client->proxy_ev_tls_options, client->proxy_ev_settings->tls_options)) { @@ -446,11 +446,14 @@ struct aws_s3_client *aws_s3_client_new( if (client->proxy_config) { aws_http_proxy_config_destroy(client->proxy_config); } - if (client->proxy_ev_settings->tls_options) { + if (client->proxy_ev_tls_options) { aws_tls_connection_options_clean_up(client->proxy_ev_tls_options); aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; } + if (client->proxy_ev_settings) { + aws_mem_release(client->allocator, client->proxy_ev_settings); + } aws_event_loop_group_release(client->client_bootstrap->event_loop_group); aws_client_bootstrap_release(client->client_bootstrap); @@ -536,6 +539,10 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { client->proxy_ev_settings->tls_options = NULL; } + if (client->proxy_ev_settings) { + aws_mem_release(client->allocator, client->proxy_ev_settings); + } + aws_mutex_clean_up(&client->synced_data.lock); AWS_ASSERT(aws_linked_list_empty(&client->synced_data.pending_meta_request_work)); From 4fca7d39fa8145486c5c0c64383372165315ebba Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 10:02:38 -0700 Subject: [PATCH 17/33] Fix memory management issues --- source/s3_endpoint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 6388ffc75..a61e79c1d 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -154,6 +154,7 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ socket_options.keep_alive_interval_sec = tcp_keep_alive_options.keep_alive_interval_sec; socket_options.keep_alive_timeout_sec = tcp_keep_alive_options.keep_alive_timeout_sec; socket_options.keep_alive_max_failed_probes = tcp_keep_alive_options.keep_alive_max_failed_probes; + struct proxy_env_var_settings proxy_ev_settings_default; /* Turn on envrionment variable for proxy by default */ if (proxy_ev_settings == NULL) { @@ -161,8 +162,6 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ proxy_ev_settings_default.env_var_type = AWS_HPEV_ENABLE; proxy_ev_settings = &proxy_ev_settings_default; } - socket_options.connect_timeout_ms = s_connection_timeout_ms; - struct aws_http_proxy_options *proxy_options; struct aws_http_connection_manager_options manager_options; AWS_ZERO_STRUCT(manager_options); @@ -174,10 +173,11 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ manager_options.shutdown_complete_callback = s_s3_endpoint_http_connection_manager_shutdown_callback; manager_options.shutdown_complete_user_data = endpoint; manager_options.proxy_ev_settings = proxy_ev_settings; + + struct aws_http_proxy_options proxy_options; if (proxy_config != NULL) { - proxy_options = aws_mem_calloc(endpoint->allocator, 1, sizeof(struct aws_http_proxy_options)); - aws_http_proxy_options_init_from_config(proxy_options, proxy_config); - manager_options.proxy_options = proxy_options; + aws_http_proxy_options_init_from_config(&proxy_options, proxy_config); + manager_options.proxy_options = &proxy_options; } struct aws_tls_connection_options *manager_tls_options = NULL; From 15b1c9057b54992a411b2acee65632717ea9af24 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 10:10:01 -0700 Subject: [PATCH 18/33] Minor improvement --- source/s3_endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index a61e79c1d..137838cbf 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -143,8 +143,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ AWS_PRECONDITION(host_name); struct aws_byte_cursor host_name_cursor = aws_byte_cursor_from_string(host_name); - /* Try to set up an HTTP connection manager. */ + /* Try to set up an HTTP connection manager. */ struct aws_socket_options socket_options; AWS_ZERO_STRUCT(socket_options); socket_options.type = AWS_SOCKET_STREAM; From fc91d20267b398ff7766995318009bc27c6cce5b Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 10:19:51 -0700 Subject: [PATCH 19/33] Updates include proxy.h --- include/aws/s3/private/s3_client_impl.h | 1 + include/aws/s3/s3_client.h | 1 - source/s3_endpoint.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index ec2eb6498..7a31eaeac 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -16,6 +16,7 @@ #include #include #include +#include /* TODO automate this value in the future to prevent it from becoming out-of-sync. */ #define AWS_S3_CLIENT_VERSION "0.1.x" diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 4b3571a23..2b6704b66 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -7,7 +7,6 @@ */ #include -#include #include #include diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 137838cbf..9c22204b2 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -20,7 +20,6 @@ #include #include #include -#include //Todo: maybe remove from here #include #include #include From 3e2e3235b012fe364f6618c97ba053763ba61d84 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 11:11:36 -0700 Subject: [PATCH 20/33] Fix comment --- include/aws/s3/private/s3_client_impl.h | 4 ++-- include/aws/s3/s3_client.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 7a31eaeac..317491369 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -68,7 +68,7 @@ struct aws_s3_endpoint_options { /* * Optional. - * Configuration for using proxy from environment variable. + * Configuration for fetching proxy options from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy * configuration from environment variables. * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. @@ -215,7 +215,7 @@ struct aws_s3_client { /* * Optional. - * Configuration for using proxy from environment variable. + * Configuration for fetching proxy options from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy * configuration from environment variables. * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 2b6704b66..4c3f3cfa1 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -224,7 +224,7 @@ struct aws_s3_client_config { /* * Optional. - * Configuration for using proxy from environment variable. + * Configuration for fetching proxy options from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy * configuration from environment variables. * Only works when proxy_options is not set. If both are set, configuration from proxy_options is used. From 7784a72b0b4329a571f010fec1299b73800637ef Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 11:14:45 -0700 Subject: [PATCH 21/33] improve comment --- include/aws/s3/private/s3_client_impl.h | 8 ++++---- include/aws/s3/s3_client.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 317491369..610fed0d5 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -68,9 +68,9 @@ struct aws_s3_endpoint_options { /* * Optional. - * Configuration for fetching proxy options from environment. + * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy - * configuration from environment variables. + * configuration from environment. * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. */ struct proxy_env_var_settings *proxy_ev_settings; @@ -215,9 +215,9 @@ struct aws_s3_client { /* * Optional. - * Configuration for fetching proxy options from environment. + * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy - * configuration from environment variables. + * configuration from environment. * Only works when proxy_config is not set. If both are set, configuration from proxy_config is used. */ struct proxy_env_var_settings *proxy_ev_settings; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 4c3f3cfa1..e6047205b 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -224,9 +224,9 @@ struct aws_s3_client_config { /* * Optional. - * Configuration for fetching proxy options from environment. + * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy - * configuration from environment variables. + * configuration from environment. * Only works when proxy_options is not set. If both are set, configuration from proxy_options is used. */ struct proxy_env_var_settings *proxy_ev_settings; From 9134dd93b9c71452a163a2afd7069a5783f775ee Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 14:08:16 -0700 Subject: [PATCH 22/33] Expose monitoring options --- include/aws/s3/private/s3_client_impl.h | 21 ++++++++++++++++++--- include/aws/s3/s3_client.h | 11 +++++++++-- source/s3_client.c | 20 ++++++++++++-------- source/s3_endpoint.c | 12 +++++++++--- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 610fed0d5..50e042ee4 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -66,7 +67,7 @@ struct aws_s3_endpoint_options { */ struct aws_http_proxy_config *proxy_config; - /* + /** * Optional. * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy @@ -86,6 +87,13 @@ struct aws_s3_endpoint_options { * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + + /** + * Optional. + * Configuration options for connection monitoring. + * If the transfer speed falls below the specified minimum_throughput_bytes_per_second, the operation is aborted. + */ + struct aws_http_connection_monitoring_options *monitoring_options; }; struct aws_s3_endpoint { @@ -213,7 +221,7 @@ struct aws_s3_client { */ struct aws_http_proxy_config *proxy_config; - /* + /** * Optional. * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy @@ -228,12 +236,19 @@ struct aws_s3_client { */ uint32_t connect_timeout_ms; - /* + /** * Optional. * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + /** + * Optional. + * Configuration options for connection monitoring. + * If the transfer speed falls below the specified minimum_throughput_bytes_per_second, the operation is aborted. + */ + struct aws_http_connection_monitoring_options *monitoring_options; + /* tls options from proxy environment settings. */ struct aws_tls_connection_options *proxy_ev_tls_options; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index e6047205b..4988f68e3 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -222,7 +222,7 @@ struct aws_s3_client_config { */ struct aws_http_proxy_options *proxy_options; - /* + /** * Optional. * Configuration for fetching proxy configuration from environment. * By Default proxy_ev_settings.aws_http_proxy_env_var_type is set to AWS_HPEV_ENABLE which means read proxy @@ -237,11 +237,18 @@ struct aws_s3_client_config { */ uint32_t connect_timeout_ms; - /* + /** * Optional. * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + + /** + * Optional. + * Configuration options for connection monitoring. + * If the transfer speed falls below the specified minimum_throughput_bytes_per_second, the operation is aborted. + */ + struct aws_http_connection_monitoring_options *monitoring_options; }; /* Options for a new meta request, ie, file transfer that will be handled by the high performance client. */ diff --git a/source/s3_client.c b/source/s3_client.c index 2bee66d0b..61b32c0b8 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -326,6 +326,12 @@ struct aws_s3_client *aws_s3_client_new( client->tcp_keep_alive_options = client_config->tcp_keep_alive_options; + if (client_config->monitoring_options) { + client->monitoring_options = + aws_mem_calloc(allocator, 1, sizeof(struct aws_http_connection_monitoring_options)); + *client->monitoring_options = *client_config->monitoring_options; + } + if (client_config->tls_mode == AWS_MR_TLS_ENABLED) { client->tls_connection_options = aws_mem_calloc(client->allocator, 1, sizeof(struct aws_tls_connection_options)); @@ -451,9 +457,8 @@ struct aws_s3_client *aws_s3_client_new( aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; } - if (client->proxy_ev_settings) { - aws_mem_release(client->allocator, client->proxy_ev_settings); - } + aws_mem_release(client->allocator, client->proxy_ev_settings); + aws_mem_release(client->allocator, client->monitoring_options); aws_event_loop_group_release(client->client_bootstrap->event_loop_group); aws_client_bootstrap_release(client->client_bootstrap); @@ -538,10 +543,8 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { aws_mem_release(client->allocator, client->proxy_ev_tls_options); client->proxy_ev_settings->tls_options = NULL; } - - if (client->proxy_ev_settings) { - aws_mem_release(client->allocator, client->proxy_ev_settings); - } + aws_mem_release(client->allocator, client->proxy_ev_settings); + aws_mem_release(client->allocator, client->monitoring_options); aws_mutex_clean_up(&client->synced_data.lock); @@ -734,7 +737,8 @@ struct aws_s3_meta_request *aws_s3_client_make_meta_request( .proxy_config = client->proxy_config, .proxy_ev_settings = client->proxy_ev_settings, .connect_timeout_ms = client->connect_timeout_ms, - .tcp_keep_alive_options = client->tcp_keep_alive_options}; + .tcp_keep_alive_options = client->tcp_keep_alive_options, + .monitoring_options = client->monitoring_options}; endpoint = aws_s3_endpoint_new(client->allocator, &endpoint_options); diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 9c22204b2..21264b7fb 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -54,7 +54,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, - const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options); + const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options, + const struct aws_http_connection_monitoring_options *monitoring_options); static void s_s3_endpoint_http_connection_manager_shutdown_callback(void *user_data); @@ -105,7 +106,8 @@ struct aws_s3_endpoint *aws_s3_endpoint_new( options->proxy_config, options->proxy_ev_settings, options->connect_timeout_ms, - options->tcp_keep_alive_options); + options->tcp_keep_alive_options, + options->monitoring_options); if (endpoint->http_connection_manager == NULL) { goto error_cleanup; @@ -135,7 +137,8 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, - const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options) { + const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options, + const struct aws_http_connection_monitoring_options *monitoring_options) { AWS_PRECONDITION(endpoint); AWS_PRECONDITION(client_bootstrap); @@ -172,6 +175,9 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ manager_options.shutdown_complete_callback = s_s3_endpoint_http_connection_manager_shutdown_callback; manager_options.shutdown_complete_user_data = endpoint; manager_options.proxy_ev_settings = proxy_ev_settings; + if (monitoring_options != NULL) { + manager_options.monitoring_options = monitoring_options; + } struct aws_http_proxy_options proxy_options; if (proxy_config != NULL) { From 866e11ba85cf37694732c407870802f7d94396f2 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 14:49:46 -0700 Subject: [PATCH 23/33] Adds test for monitoring options and proxy ev settings --- tests/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3d5bf04b4..7a7966c4c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,12 +3,12 @@ enable_testing() option(BYO_CRYPTO "Don't build a tls implementation or link against a crypto interface. This feature is only for unix builds currently." OFF) -if(BYO_CRYPTO) +if (BYO_CRYPTO) set(ENABLE_NET_TESTS OFF) add_test_case(test_s3_client_byo_crypto_no_options) add_test_case(test_s3_client_byo_crypto_with_options) -endif() +endif () file(GLOB TEST_SRC "*.c") file(GLOB TEST_HDRS "*.h") @@ -24,6 +24,8 @@ add_test_case(test_s3_complete_multipart_message_new) add_test_case(test_s3_abort_multipart_upload_message_new) add_net_test_case(test_s3_client_create_destroy) +add_net_test_case(test_s3_client_monitoring_options_override) +add_net_test_case(test_s3_client_proxy_ev_settings_override) add_net_test_case(test_s3_client_max_active_connections_override) add_test_case(test_s3_client_get_max_active_connections) add_test_case(test_s3_request_create_destroy) From 0e199e889ad15d75d0c5dca8ffa85fd6b9ef61d4 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 14:50:14 -0700 Subject: [PATCH 24/33] Adds test for monitoring options and proxy ev setting override --- tests/s3_data_plane_tests.c | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index d0cf3131b..eb01cb46e 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -51,6 +51,55 @@ static int s_test_s3_client_create_destroy(struct aws_allocator *allocator, void return 0; } +AWS_TEST_CASE(test_s3_client_monitoring_options_override, s_test_s3_client_monitoring_options_override) +static int s_test_s3_client_monitoring_options_override(struct aws_allocator *allocator, void *ctx) { + (void)ctx; + + struct aws_s3_tester tester; + AWS_ZERO_STRUCT(tester); + ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); + + struct aws_http_connection_monitoring_options monitoring_options = {.minimum_throughput_bytes_per_second = 3000}; + + struct aws_s3_client_config client_config = {.monitoring_options = &monitoring_options}; + + ASSERT_SUCCESS(aws_s3_tester_bind_client(&tester, &client_config, 0)); + + struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); + + ASSERT_TRUE( + client->monitoring_options->minimum_throughput_bytes_per_second == + client_config.monitoring_options->minimum_throughput_bytes_per_second); + + aws_s3_client_release(client); + aws_s3_tester_clean_up(&tester); + + return 0; +} + +AWS_TEST_CASE(test_s3_client_proxy_ev_settings_override, s_test_s3_client_proxy_ev_settings_override) +static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *allocator, void *ctx) { + (void)ctx; + + struct aws_s3_tester tester; + AWS_ZERO_STRUCT(tester); + ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); + + struct proxy_env_var_settings proxy_ev_settings = {.env_var_type = AWS_HPEV_DISABLE}; + + struct aws_s3_client_config client_config = {.proxy_ev_settings = &proxy_ev_settings}; + + ASSERT_SUCCESS(aws_s3_tester_bind_client(&tester, &client_config, 0)); + + struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); + + ASSERT_TRUE(client->proxy_ev_settings->env_var_type == client_config.proxy_ev_settings->env_var_type); + aws_s3_client_release(client); + aws_s3_tester_clean_up(&tester); + + return 0; +} + AWS_TEST_CASE(test_s3_client_max_active_connections_override, s_test_s3_client_max_active_connections_override) static int s_test_s3_client_max_active_connections_override(struct aws_allocator *allocator, void *ctx) { (void)ctx; From 752d47bd24880461ca6a7a5c765b71e139214a25 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 14:57:36 -0700 Subject: [PATCH 25/33] Update proxy ev setting test --- tests/s3_data_plane_tests.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index eb01cb46e..6ddb0c41e 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -84,8 +84,11 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all struct aws_s3_tester tester; AWS_ZERO_STRUCT(tester); ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); + struct aws_tls_connection_options tls_conn_options; + AWS_ZERO_STRUCT(tls_conn_options); - struct proxy_env_var_settings proxy_ev_settings = {.env_var_type = AWS_HPEV_DISABLE}; + struct proxy_env_var_settings proxy_ev_settings = { + .env_var_type = AWS_HPEV_ENABLE, .tls_options = &tls_conn_options}; struct aws_s3_client_config client_config = {.proxy_ev_settings = &proxy_ev_settings}; @@ -94,6 +97,8 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); ASSERT_TRUE(client->proxy_ev_settings->env_var_type == client_config.proxy_ev_settings->env_var_type); + ASSERT_TRUE(client->proxy_ev_tls_options, client_config.proxy_ev_settings->tls_options); + aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); From 072f0da45a5c7ceecb7cb5421ee9098d5a7ecc6d Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 15:23:06 -0700 Subject: [PATCH 26/33] Adds tcp keep alive override test --- tests/CMakeLists.txt | 1 + tests/s3_data_plane_tests.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7a7966c4c..5aafe491e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,6 +26,7 @@ add_test_case(test_s3_abort_multipart_upload_message_new) add_net_test_case(test_s3_client_create_destroy) add_net_test_case(test_s3_client_monitoring_options_override) add_net_test_case(test_s3_client_proxy_ev_settings_override) +add_net_test_case(test_s3_client_tcp_keep_alive_options_override) add_net_test_case(test_s3_client_max_active_connections_override) add_test_case(test_s3_client_get_max_active_connections) add_test_case(test_s3_request_create_destroy) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index 6ddb0c41e..c9f3e24b3 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -98,7 +98,31 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all ASSERT_TRUE(client->proxy_ev_settings->env_var_type == client_config.proxy_ev_settings->env_var_type); ASSERT_TRUE(client->proxy_ev_tls_options, client_config.proxy_ev_settings->tls_options); - + + aws_s3_client_release(client); + aws_s3_tester_clean_up(&tester); + + return 0; +} + +AWS_TEST_CASE(test_s3_client_tcp_keep_alive_options_override, s_test_s3_client_tcp_keep_alive_options_override) +static int s_test_s3_client_tcp_keep_alive_options_override(struct aws_allocator *allocator, void *ctx) { + (void)ctx; + + struct aws_s3_tester tester; + AWS_ZERO_STRUCT(tester); + ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); + + struct aws_s3_tcp_keep_alive_options keep_alive_options = {.keepalive = true}; + + struct aws_s3_client_config client_config = {.tcp_keep_alive_options = keep_alive_options}; + + ASSERT_SUCCESS(aws_s3_tester_bind_client(&tester, &client_config, 0)); + + struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); + + ASSERT_TRUE(client->tcp_keep_alive_options.keepalive, client_config.tcp_keep_alive_options.keepalive); + aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); From 2341407801b8ef522a39b0aee0ee1cfc4e5d57ea Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 15:59:43 -0700 Subject: [PATCH 27/33] lint fix --- tests/s3_data_plane_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index c9f3e24b3..da40bba8a 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -87,8 +87,8 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all struct aws_tls_connection_options tls_conn_options; AWS_ZERO_STRUCT(tls_conn_options); - struct proxy_env_var_settings proxy_ev_settings = { - .env_var_type = AWS_HPEV_ENABLE, .tls_options = &tls_conn_options}; + struct proxy_env_var_settings proxy_ev_settings = {.env_var_type = AWS_HPEV_ENABLE, + .tls_options = &tls_conn_options}; struct aws_s3_client_config client_config = {.proxy_ev_settings = &proxy_ev_settings}; From 58caf036c046f3b1d4e1ded63066657f1fc5b95d Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 16:34:18 -0700 Subject: [PATCH 28/33] Use Keep Alive pointer --- include/aws/s3/private/s3_client_impl.h | 4 ++-- include/aws/s3/s3_client.h | 5 +---- source/s3_client.c | 7 ++++++- source/s3_endpoint.c | 15 ++++++++------- tests/s3_data_plane_tests.c | 8 +++++--- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 50e042ee4..c06450b26 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -86,7 +86,7 @@ struct aws_s3_endpoint_options { * Optional. * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ - struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options; /** * Optional. @@ -240,7 +240,7 @@ struct aws_s3_client { * Optional. * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ - struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options; /** * Optional. diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 4988f68e3..a6fb8c711 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -154,9 +154,6 @@ enum aws_s3_checksum_algorithm { */ struct aws_s3_tcp_keep_alive_options { - /* Set keepalive true to periodically transmit messages for detecting a disconnected peer.*/ - bool keepalive; - uint16_t keep_alive_interval_sec; uint16_t keep_alive_timeout_sec; @@ -241,7 +238,7 @@ struct aws_s3_client_config { * Optional. * Set keepalive true to periodically transmit messages for detecting a disconnected peer. */ - struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options; + struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options; /** * Optional. diff --git a/source/s3_client.c b/source/s3_client.c index 61b32c0b8..5aa3a2e61 100644 --- a/source/s3_client.c +++ b/source/s3_client.c @@ -324,7 +324,10 @@ struct aws_s3_client *aws_s3_client_new( } } - client->tcp_keep_alive_options = client_config->tcp_keep_alive_options; + if (client_config->tcp_keep_alive_options) { + client->tcp_keep_alive_options = aws_mem_calloc(allocator, 1, sizeof(struct aws_s3_tcp_keep_alive_options)); + *client->tcp_keep_alive_options = *client_config->tcp_keep_alive_options; + } if (client_config->monitoring_options) { client->monitoring_options = @@ -459,6 +462,7 @@ struct aws_s3_client *aws_s3_client_new( } aws_mem_release(client->allocator, client->proxy_ev_settings); aws_mem_release(client->allocator, client->monitoring_options); + aws_mem_release(client->allocator, client->tcp_keep_alive_options); aws_event_loop_group_release(client->client_bootstrap->event_loop_group); aws_client_bootstrap_release(client->client_bootstrap); @@ -545,6 +549,7 @@ static void s_s3_client_finish_destroy_default(struct aws_s3_client *client) { } aws_mem_release(client->allocator, client->proxy_ev_settings); aws_mem_release(client->allocator, client->monitoring_options); + aws_mem_release(client->allocator, client->tcp_keep_alive_options); aws_mutex_clean_up(&client->synced_data.lock); diff --git a/source/s3_endpoint.c b/source/s3_endpoint.c index 21264b7fb..177ee3dc5 100644 --- a/source/s3_endpoint.c +++ b/source/s3_endpoint.c @@ -54,7 +54,7 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, - const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options, + const struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options, const struct aws_http_connection_monitoring_options *monitoring_options); static void s_s3_endpoint_http_connection_manager_shutdown_callback(void *user_data); @@ -137,7 +137,7 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ const struct aws_http_proxy_config *proxy_config, const struct proxy_env_var_settings *proxy_ev_settings, uint32_t connect_timeout_ms, - const struct aws_s3_tcp_keep_alive_options tcp_keep_alive_options, + const struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options, const struct aws_http_connection_monitoring_options *monitoring_options) { AWS_PRECONDITION(endpoint); @@ -152,11 +152,12 @@ static struct aws_http_connection_manager *s_s3_endpoint_create_http_connection_ socket_options.type = AWS_SOCKET_STREAM; socket_options.domain = AWS_SOCKET_IPV4; socket_options.connect_timeout_ms = connect_timeout_ms == 0 ? s_connection_timeout_ms : connect_timeout_ms; - socket_options.keepalive = tcp_keep_alive_options.keepalive; - socket_options.keep_alive_interval_sec = tcp_keep_alive_options.keep_alive_interval_sec; - socket_options.keep_alive_timeout_sec = tcp_keep_alive_options.keep_alive_timeout_sec; - socket_options.keep_alive_max_failed_probes = tcp_keep_alive_options.keep_alive_max_failed_probes; - + if (tcp_keep_alive_options != NULL) { + socket_options.keepalive = true; + socket_options.keep_alive_interval_sec = tcp_keep_alive_options->keep_alive_interval_sec; + socket_options.keep_alive_timeout_sec = tcp_keep_alive_options->keep_alive_timeout_sec; + socket_options.keep_alive_max_failed_probes = tcp_keep_alive_options->keep_alive_max_failed_probes; + } struct proxy_env_var_settings proxy_ev_settings_default; /* Turn on envrionment variable for proxy by default */ if (proxy_ev_settings == NULL) { diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index da40bba8a..1be8d5541 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -113,15 +113,17 @@ static int s_test_s3_client_tcp_keep_alive_options_override(struct aws_allocator AWS_ZERO_STRUCT(tester); ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); - struct aws_s3_tcp_keep_alive_options keep_alive_options = {.keepalive = true}; + struct aws_s3_tcp_keep_alive_options keep_alive_options = {.keep_alive_interval_sec = 20}; - struct aws_s3_client_config client_config = {.tcp_keep_alive_options = keep_alive_options}; + struct aws_s3_client_config client_config = {.tcp_keep_alive_options = &keep_alive_options}; ASSERT_SUCCESS(aws_s3_tester_bind_client(&tester, &client_config, 0)); struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); - ASSERT_TRUE(client->tcp_keep_alive_options.keepalive, client_config.tcp_keep_alive_options.keepalive); + ASSERT_TRUE( + client->tcp_keep_alive_options->keep_alive_interval_sec, + client_config.tcp_keep_alive_options->keep_alive_interval_sec); aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); From 014494c6a50face6aafbb9cac1f291f7440a4f7d Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 16:52:06 -0700 Subject: [PATCH 29/33] Fix tests --- tests/s3_data_plane_tests.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index 1be8d5541..318762242 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -86,9 +86,9 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); struct aws_tls_connection_options tls_conn_options; AWS_ZERO_STRUCT(tls_conn_options); - - struct proxy_env_var_settings proxy_ev_settings = {.env_var_type = AWS_HPEV_ENABLE, - .tls_options = &tls_conn_options}; + + struct proxy_env_var_settings proxy_ev_settings = { + .env_var_type = AWS_HPEV_ENABLE, .tls_options = &tls_conn_options}; struct aws_s3_client_config client_config = {.proxy_ev_settings = &proxy_ev_settings}; @@ -97,7 +97,6 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); ASSERT_TRUE(client->proxy_ev_settings->env_var_type == client_config.proxy_ev_settings->env_var_type); - ASSERT_TRUE(client->proxy_ev_tls_options, client_config.proxy_ev_settings->tls_options); aws_s3_client_release(client); aws_s3_tester_clean_up(&tester); @@ -122,7 +121,7 @@ static int s_test_s3_client_tcp_keep_alive_options_override(struct aws_allocator struct aws_s3_client *client = aws_s3_client_new(allocator, &client_config); ASSERT_TRUE( - client->tcp_keep_alive_options->keep_alive_interval_sec, + client->tcp_keep_alive_options->keep_alive_interval_sec == client_config.tcp_keep_alive_options->keep_alive_interval_sec); aws_s3_client_release(client); From 5635f1d8e2ba5c8d972b6bb87302b9df4442d6dc Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 16:53:12 -0700 Subject: [PATCH 30/33] Fix lint --- tests/s3_data_plane_tests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/s3_data_plane_tests.c b/tests/s3_data_plane_tests.c index 318762242..32cdb099b 100644 --- a/tests/s3_data_plane_tests.c +++ b/tests/s3_data_plane_tests.c @@ -86,9 +86,9 @@ static int s_test_s3_client_proxy_ev_settings_override(struct aws_allocator *all ASSERT_SUCCESS(aws_s3_tester_init(allocator, &tester)); struct aws_tls_connection_options tls_conn_options; AWS_ZERO_STRUCT(tls_conn_options); - - struct proxy_env_var_settings proxy_ev_settings = { - .env_var_type = AWS_HPEV_ENABLE, .tls_options = &tls_conn_options}; + + struct proxy_env_var_settings proxy_ev_settings = {.env_var_type = AWS_HPEV_ENABLE, + .tls_options = &tls_conn_options}; struct aws_s3_client_config client_config = {.proxy_ev_settings = &proxy_ev_settings}; From 22e3ac569e4fe4852823bb58b9fa7f2606273f1d Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 29 Aug 2022 20:10:07 -0700 Subject: [PATCH 31/33] Removes hard coded default value --- include/aws/s3/private/s3_client_impl.h | 4 ++-- include/aws/s3/s3_client.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index c06450b26..d31334b26 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -78,7 +78,7 @@ struct aws_s3_endpoint_options { /** * Optional. - * If set to 0, default value (3000) is used. + * If not set, default value is used. */ uint32_t connect_timeout_ms; @@ -232,7 +232,7 @@ struct aws_s3_client { /** * Optional. - * If set to 0, default value (3000) is used. + * If not set, default value is used. */ uint32_t connect_timeout_ms; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index a6fb8c711..a7e7b7725 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -230,7 +230,7 @@ struct aws_s3_client_config { /** * Optional. - * If set to 0, default value (3000) is used. + * If not set, default value is used. */ uint32_t connect_timeout_ms; From acbd85c21820f54d0c748d8f3a3e4d088159fb0b Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 30 Aug 2022 08:43:19 -0700 Subject: [PATCH 32/33] Updates comment --- include/aws/s3/private/s3_client_impl.h | 4 ++-- include/aws/s3/s3_client.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index d31334b26..636bfc2be 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -78,7 +78,7 @@ struct aws_s3_endpoint_options { /** * Optional. - * If not set, default value is used. + * If set to 0, default value is used. */ uint32_t connect_timeout_ms; @@ -232,7 +232,7 @@ struct aws_s3_client { /** * Optional. - * If not set, default value is used. + * If set to 0, default value is used. */ uint32_t connect_timeout_ms; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index a7e7b7725..304275b36 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -230,7 +230,7 @@ struct aws_s3_client_config { /** * Optional. - * If not set, default value is used. + * If set to 0, default value is used. */ uint32_t connect_timeout_ms; From 0913ce76b6702bc4d600fd43e2b211aa89ec48d7 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 30 Aug 2022 10:02:11 -0700 Subject: [PATCH 33/33] Update keep alive comment --- include/aws/s3/private/s3_client_impl.h | 4 ++-- include/aws/s3/s3_client.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aws/s3/private/s3_client_impl.h b/include/aws/s3/private/s3_client_impl.h index 636bfc2be..fbe6d48ca 100644 --- a/include/aws/s3/private/s3_client_impl.h +++ b/include/aws/s3/private/s3_client_impl.h @@ -84,7 +84,7 @@ struct aws_s3_endpoint_options { /** * Optional. - * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + * Set keepalive to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options; @@ -238,7 +238,7 @@ struct aws_s3_client { /** * Optional. - * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + * Set keepalive to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options; diff --git a/include/aws/s3/s3_client.h b/include/aws/s3/s3_client.h index 304275b36..7253152c9 100644 --- a/include/aws/s3/s3_client.h +++ b/include/aws/s3/s3_client.h @@ -236,7 +236,7 @@ struct aws_s3_client_config { /** * Optional. - * Set keepalive true to periodically transmit messages for detecting a disconnected peer. + * Set keepalive to periodically transmit messages for detecting a disconnected peer. */ struct aws_s3_tcp_keep_alive_options *tcp_keep_alive_options;