diff --git a/include/aws/http/connection.h b/include/aws/http/connection.h index e6362c143..e109c6ed4 100644 --- a/include/aws/http/connection.h +++ b/include/aws/http/connection.h @@ -398,6 +398,12 @@ struct aws_http_client_connection_options { * event loop group associated with the client bootstrap. */ struct aws_event_loop *requested_event_loop; + + /** + * Optional + * Host resolution override that allows the user to override DNS behavior for this particular connection. + */ + const struct aws_host_resolution_config *host_resolution_config; }; /* Predefined settings identifiers (RFC-7540 6.5.2) */ diff --git a/include/aws/http/private/proxy_impl.h b/include/aws/http/private/proxy_impl.h index c47305b25..25b2e5b5c 100644 --- a/include/aws/http/private/proxy_impl.h +++ b/include/aws/http/private/proxy_impl.h @@ -126,6 +126,8 @@ struct aws_http_proxy_user_data { struct aws_http_proxy_config *proxy_config; struct aws_event_loop *requested_event_loop; + + const struct aws_host_resolution_config *host_resolution_config; }; struct aws_http_proxy_system_vtable { diff --git a/include/aws/http/websocket.h b/include/aws/http/websocket.h index 6f85cafa8..cdeb6a0f3 100644 --- a/include/aws/http/websocket.h +++ b/include/aws/http/websocket.h @@ -280,6 +280,12 @@ struct aws_websocket_client_connection_options { * a single thread. */ struct aws_event_loop *requested_event_loop; + + /** + * Optional + * Host resolution override that allows the user to override DNS behavior for this particular connection. + */ + const struct aws_host_resolution_config *host_resolution_config; }; /** diff --git a/source/connection.c b/source/connection.c index f020823dc..4a49e7728 100644 --- a/source/connection.c +++ b/source/connection.c @@ -1100,6 +1100,7 @@ int aws_http_client_connect_internal( .enable_read_back_pressure = options.manual_window_management, .user_data = http_bootstrap, .requested_event_loop = options.requested_event_loop, + .host_resolution_override_config = options.host_resolution_config, }; err = s_system_vtable_ptr->new_socket_channel(&channel_options); diff --git a/source/proxy_connection.c b/source/proxy_connection.c index e6cdb8a24..b09bad3c9 100644 --- a/source/proxy_connection.c +++ b/source/proxy_connection.c @@ -162,6 +162,7 @@ struct aws_http_proxy_user_data *aws_http_proxy_user_data_new( user_data->original_channel_on_setup = on_channel_setup; user_data->original_channel_on_shutdown = on_channel_shutdown; user_data->requested_event_loop = options.requested_event_loop; + user_data->host_resolution_config = options.host_resolution_config; user_data->prior_knowledge_http2 = options.prior_knowledge_http2; /* one and only one setup callback must be valid */ @@ -1048,6 +1049,7 @@ static int s_aws_http_client_connect_via_forwarding_proxy(const struct aws_http_ options_copy.on_shutdown = s_aws_http_on_client_connection_http_proxy_shutdown_fn; options_copy.tls_options = options->proxy_options->tls_options; options_copy.requested_event_loop = options->requested_event_loop; + options_copy.host_resolution_config = options->host_resolution_config; options_copy.prior_knowledge_http2 = false; /* ToDo, expose the protocol specific config for proxy connection. */ int result = aws_http_client_connect_internal(&options_copy, s_proxy_http_request_transform); @@ -1084,6 +1086,7 @@ static int s_create_tunneling_connection(struct aws_http_proxy_user_data *user_d connect_options.http1_options = NULL; /* ToDo, expose the protocol specific config for proxy connection. */ connect_options.http2_options = NULL; /* ToDo */ connect_options.requested_event_loop = user_data->requested_event_loop; + connect_options.host_resolution_config = user_data->host_resolution_config; int result = aws_http_client_connect(&connect_options); if (result == AWS_OP_ERR) { @@ -1642,6 +1645,7 @@ int aws_http_proxy_new_socket_channel( http_connection_options.on_setup = NULL; /* use channel callbacks, not http callbacks */ http_connection_options.on_shutdown = NULL; /* use channel callbacks, not http callbacks */ http_connection_options.requested_event_loop = channel_options->requested_event_loop; + http_connection_options.host_resolution_config = channel_options->host_resolution_override_config; if (s_aws_http_client_connect_via_tunneling_proxy( &http_connection_options, s_http_proxied_socket_channel_setup, s_http_proxied_socket_channel_shutdown)) { diff --git a/source/websocket_bootstrap.c b/source/websocket_bootstrap.c index b52258730..e840e7790 100644 --- a/source/websocket_bootstrap.c +++ b/source/websocket_bootstrap.c @@ -215,6 +215,7 @@ int aws_websocket_client_connect(const struct aws_websocket_client_connection_op http_options.on_setup = s_ws_bootstrap_on_http_setup; http_options.on_shutdown = s_ws_bootstrap_on_http_shutdown; http_options.requested_event_loop = options->requested_event_loop; + http_options.host_resolution_config = options->host_resolution_config; /* Infer port, if not explicitly specified in URI */ http_options.port = options->port;