diff options
author | thegeorg <[email protected]> | 2025-05-12 15:51:24 +0300 |
---|---|---|
committer | thegeorg <[email protected]> | 2025-05-12 16:06:27 +0300 |
commit | d629bb70c8773d2c0c43f5088ddbb5a86d8c37ea (patch) | |
tree | 4f678e0d65ad08c800db21c657d3b0f71fafed06 /contrib/restricted/aws/aws-c-http/source/connection.c | |
parent | 92c4b696d7a1c03d54e13aff7a7c20a078d90dd7 (diff) |
Update contrib/restricted/aws libraries to nixpkgs 24.05
commit_hash:f8083acb039e6005e820cdee77b84e0a6b6c6d6d
Diffstat (limited to 'contrib/restricted/aws/aws-c-http/source/connection.c')
-rw-r--r-- | contrib/restricted/aws/aws-c-http/source/connection.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/contrib/restricted/aws/aws-c-http/source/connection.c b/contrib/restricted/aws/aws-c-http/source/connection.c index f020823dcf1..a53aebe1912 100644 --- a/contrib/restricted/aws/aws-c-http/source/connection.c +++ b/contrib/restricted/aws/aws-c-http/source/connection.c @@ -18,6 +18,7 @@ #include <aws/io/channel_bootstrap.h> #include <aws/io/logging.h> #include <aws/io/socket.h> +#include <aws/io/socket_channel_handler.h> #include <aws/io/tls_channel_handler.h> #ifdef _MSC_VER @@ -26,7 +27,7 @@ #endif static struct aws_http_connection_system_vtable s_default_system_vtable = { - .new_socket_channel = aws_client_bootstrap_new_socket_channel, + .aws_client_bootstrap_new_socket_channel = aws_client_bootstrap_new_socket_channel, }; static const struct aws_http_connection_system_vtable *s_system_vtable_ptr = &s_default_system_vtable; @@ -366,6 +367,16 @@ struct aws_channel *aws_http_connection_get_channel(struct aws_http_connection * return connection->channel_slot->channel; } +const struct aws_socket_endpoint *aws_http_connection_get_remote_endpoint( + const struct aws_http_connection *connection) { + AWS_ASSERT(connection); + struct aws_channel *channel = connection->channel_slot->channel; + /* The first slot for an HTTP connection is always socket */ + struct aws_channel_slot *socket_slot = aws_channel_get_first_slot(channel); + const struct aws_socket *socket = aws_socket_handler_get_socket(socket_slot->handler); + return &socket->remote_endpoint; +} + int aws_http_alpn_map_init(struct aws_allocator *allocator, struct aws_hash_table *map) { AWS_ASSERT(allocator); AWS_ASSERT(map); @@ -495,7 +506,7 @@ static void s_server_bootstrap_on_accept_channel_setup( if (put_err) { AWS_LOGF_ERROR( AWS_LS_HTTP_SERVER, - "%p: %s:%d: Failed to store connection object, error %d (%s).", + "%p: %s:%u: Failed to store connection object, error %d (%s).", (void *)server, server->socket->local_endpoint.address, server->socket->local_endpoint.port, @@ -508,7 +519,7 @@ static void s_server_bootstrap_on_accept_channel_setup( /* Tell user of successful connection. */ AWS_LOGF_INFO( AWS_LS_HTTP_CONNECTION, - "id=%p: " PRInSTR " server connection established at %p %s:%d.", + "id=%p: " PRInSTR " server connection established at %p %s:%u.", (void *)connection, AWS_BYTE_CURSOR_PRI(aws_http_version_to_str(connection->http_version)), (void *)server, @@ -690,7 +701,7 @@ struct aws_http_server *aws_http_server_new(const struct aws_http_server_options AWS_LOGF_INFO( AWS_LS_HTTP_SERVER, - "%p %s:%d: Server setup complete, listening for incoming connections.", + "%p %s:%u: Server setup complete, listening for incoming connections.", (void *)server, server->socket->local_endpoint.address, server->socket->local_endpoint.port); @@ -740,7 +751,7 @@ void aws_http_server_release(struct aws_http_server *server) { * s_server_bootstrap_on_server_listener_destroy will be invoked, clean up of the server will be there */ AWS_LOGF_INFO( AWS_LS_HTTP_SERVER, - "%p %s:%d: Shutting down the server.", + "%p %s:%u: Shutting down the server.", (void *)server, server->socket->local_endpoint.address, server->socket->local_endpoint.port); @@ -751,6 +762,12 @@ void aws_http_server_release(struct aws_http_server *server) { * clean up will be called from eventloop */ } +const struct aws_socket_endpoint *aws_http_server_get_listener_endpoint(const struct aws_http_server *server) { + AWS_FATAL_ASSERT(server); + + return &server->socket->local_endpoint; +} + /* At this point, the channel bootstrapper has established a connection to the server and set up a channel. * Now we need to create the aws_http_connection and insert it into the channel as a channel-handler. */ static void s_client_bootstrap_on_channel_setup( @@ -823,6 +840,8 @@ static void s_client_bootstrap_on_channel_setup( } http_bootstrap->connection->proxy_request_transform = http_bootstrap->proxy_request_transform; + http_bootstrap->connection->client_data->response_first_byte_timeout_ms = + http_bootstrap->response_first_byte_timeout_ms; AWS_LOGF_INFO( AWS_LS_HTTP_CONNECTION, @@ -1062,6 +1081,7 @@ int aws_http_client_connect_internal( http_bootstrap->proxy_request_transform = proxy_request_transform; http_bootstrap->http1_options = *options.http1_options; http_bootstrap->http2_options = *options.http2_options; + http_bootstrap->response_first_byte_timeout_ms = options.response_first_byte_timeout_ms; /* keep a copy of the settings array if it's not NULL */ if (options.http2_options->num_initial_settings > 0) { @@ -1085,9 +1105,9 @@ int aws_http_client_connect_internal( AWS_LOGF_TRACE( AWS_LS_HTTP_CONNECTION, - "static: attempting to initialize a new client channel to %s:%d", + "static: attempting to initialize a new client channel to %s:%u", aws_string_c_str(host_name), - (int)options.port); + options.port); struct aws_socket_channel_bootstrap_options channel_options = { .bootstrap = options.bootstrap, @@ -1100,9 +1120,10 @@ 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); + err = s_system_vtable_ptr->aws_client_bootstrap_new_socket_channel(&channel_options); if (err) { AWS_LOGF_ERROR( |