diff --git a/bin/elasticurl/main.c b/bin/elasticurl/main.c index 2cc673b2f..bedcb7ba0 100644 --- a/bin/elasticurl/main.c +++ b/bin/elasticurl/main.c @@ -602,7 +602,7 @@ int main(int argc, char **argv) { } bool use_tls = true; - uint16_t port = 443; + uint32_t port = 443; if (!app_ctx.uri.scheme.len && (app_ctx.uri.port == 80 || app_ctx.uri.port == 8080)) { use_tls = false; diff --git a/include/aws/http/connection.h b/include/aws/http/connection.h index 847ab2f37..031957ef0 100644 --- a/include/aws/http/connection.h +++ b/include/aws/http/connection.h @@ -272,7 +272,7 @@ struct aws_http_client_connection_options { /** * Required. */ - uint16_t port; + uint32_t port; /** * Required. diff --git a/include/aws/http/connection_manager.h b/include/aws/http/connection_manager.h index 25912740f..70b1e77b8 100644 --- a/include/aws/http/connection_manager.h +++ b/include/aws/http/connection_manager.h @@ -80,7 +80,7 @@ struct aws_http_connection_manager_options { const struct aws_http_connection_monitoring_options *monitoring_options; struct aws_byte_cursor host; - uint16_t port; + uint32_t port; /** * Optional. diff --git a/include/aws/http/http2_stream_manager.h b/include/aws/http/http2_stream_manager.h index 7b98d6492..bd7867759 100644 --- a/include/aws/http/http2_stream_manager.h +++ b/include/aws/http/http2_stream_manager.h @@ -68,7 +68,7 @@ struct aws_http2_stream_manager_options { bool http2_prior_knowledge; struct aws_byte_cursor host; - uint16_t port; + uint32_t port; /** * Optional. diff --git a/include/aws/http/private/proxy_impl.h b/include/aws/http/private/proxy_impl.h index 10a36adc6..946fece72 100644 --- a/include/aws/http/private/proxy_impl.h +++ b/include/aws/http/private/proxy_impl.h @@ -52,7 +52,7 @@ struct aws_http_proxy_config { struct aws_byte_buf host; - uint16_t port; + uint32_t port; struct aws_tls_connection_options *tls_options; @@ -97,7 +97,7 @@ struct aws_http_proxy_user_data { * Cached original connect options */ struct aws_string *original_host; - uint16_t original_port; + uint32_t original_port; void *original_user_data; struct aws_tls_connection_options *original_tls_options; struct aws_client_bootstrap *original_bootstrap; diff --git a/include/aws/http/proxy.h b/include/aws/http/proxy.h index c4c1cf812..28fdfb045 100644 --- a/include/aws/http/proxy.h +++ b/include/aws/http/proxy.h @@ -114,7 +114,7 @@ struct aws_http_proxy_options { /** * Port to make the proxy connection to */ - uint16_t port; + uint32_t port; /** * Optional. diff --git a/include/aws/http/websocket.h b/include/aws/http/websocket.h index 55460fe4e..39703b4e2 100644 --- a/include/aws/http/websocket.h +++ b/include/aws/http/websocket.h @@ -185,7 +185,7 @@ struct aws_websocket_client_connection_options { * Optional. * Defaults to 443 if tls_options is present, 80 if it is not. */ - uint16_t port; + uint32_t port; /** * Required. diff --git a/source/connection.c b/source/connection.c index b9dd1f6bf..6d53ab4b2 100644 --- a/source/connection.c +++ b/source/connection.c @@ -506,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, @@ -519,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, @@ -701,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); @@ -751,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); @@ -1099,9 +1099,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, diff --git a/source/connection_manager.c b/source/connection_manager.c index 2a2dca8a2..195a7d6ca 100644 --- a/source/connection_manager.c +++ b/source/connection_manager.c @@ -236,7 +236,7 @@ struct aws_http_connection_manager { struct aws_string *host; struct proxy_env_var_settings proxy_ev_settings; struct aws_tls_connection_options *proxy_ev_tls_options; - uint16_t port; + uint32_t port; /* * HTTP/2 specific. */ diff --git a/source/proxy_connection.c b/source/proxy_connection.c index dfb4511bf..e402a1f70 100644 --- a/source/proxy_connection.c +++ b/source/proxy_connection.c @@ -466,7 +466,7 @@ static struct aws_http_message *s_build_h1_proxy_connect_request(struct aws_http } char port_str[20] = "\0"; - snprintf(port_str, sizeof(port_str), "%d", (int)user_data->original_port); + snprintf(port_str, sizeof(port_str), "%u", user_data->original_port); struct aws_byte_cursor port_cursor = aws_byte_cursor_from_c_str(port_str); if (aws_byte_buf_append(&path_buffer, &port_cursor)) { goto on_error; diff --git a/source/websocket_bootstrap.c b/source/websocket_bootstrap.c index e840e7790..6c66c8515 100644 --- a/source/websocket_bootstrap.c +++ b/source/websocket_bootstrap.c @@ -235,7 +235,7 @@ int aws_websocket_client_connect(const struct aws_websocket_client_connection_op /* Success! (so far) */ AWS_LOGF_TRACE( AWS_LS_HTTP_WEBSOCKET_SETUP, - "id=%p: Websocket setup begun, connecting to " PRInSTR ":%" PRIu16 PRInSTR, + "id=%p: Websocket setup begun, connecting to " PRInSTR ":%" PRIu32 PRInSTR, (void *)ws_bootstrap, AWS_BYTE_CURSOR_PRI(options->host), options->port, diff --git a/tests/proxy_test_helper.c b/tests/proxy_test_helper.c index cdc8ea503..3b7d9b754 100644 --- a/tests/proxy_test_helper.c +++ b/tests/proxy_test_helper.c @@ -420,9 +420,9 @@ int proxy_tester_verify_connect_request(struct proxy_tester *tester) { snprintf( connect_request_buffer, AWS_ARRAY_SIZE(connect_request_buffer), - "CONNECT " PRInSTR ":%d HTTP/1.1", + "CONNECT " PRInSTR ":%u HTTP/1.1", AWS_BYTE_CURSOR_PRI(tester->host), - (int)tester->port); + tester->port); struct aws_byte_cursor expected_connect_message_first_line_cursor = aws_byte_cursor_from_c_str(connect_request_buffer); @@ -474,7 +474,7 @@ int proxy_tester_send_connect_response(struct proxy_tester *tester) { int proxy_tester_verify_connection_attempt_was_to_proxy( struct proxy_tester *tester, struct aws_byte_cursor expected_host, - uint16_t expected_port) { + uint32_t expected_port) { ASSERT_BIN_ARRAYS_EQUALS( tester->connection_host_name.buffer, tester->connection_host_name.len, diff --git a/tests/proxy_test_helper.h b/tests/proxy_test_helper.h index 64f507df5..3a76c3580 100644 --- a/tests/proxy_test_helper.h +++ b/tests/proxy_test_helper.h @@ -38,7 +38,7 @@ struct proxy_tester_options { struct aws_allocator *alloc; struct aws_http_proxy_options *proxy_options; struct aws_byte_cursor host; - uint16_t port; + uint32_t port; enum proxy_tester_test_mode test_mode; enum proxy_tester_failure_type failure_type; @@ -59,7 +59,7 @@ struct proxy_tester { struct aws_http_proxy_options proxy_options; struct aws_byte_cursor host; - uint16_t port; + uint32_t port; enum proxy_tester_test_mode test_mode; enum proxy_tester_failure_type failure_type; @@ -81,7 +81,7 @@ struct proxy_tester { bool tls_successful; struct aws_byte_buf connection_host_name; - uint16_t connection_port; + uint32_t connection_port; struct aws_array_list connect_requests; @@ -120,7 +120,7 @@ int proxy_tester_send_connect_response(struct proxy_tester *tester); int proxy_tester_verify_connection_attempt_was_to_proxy( struct proxy_tester *tester, struct aws_byte_cursor expected_host, - uint16_t expected_port); + uint32_t expected_port); struct testing_channel *proxy_tester_get_current_channel(struct proxy_tester *tester); diff --git a/tests/test_connection_manager.c b/tests/test_connection_manager.c index 447ff15c7..616939e99 100644 --- a/tests/test_connection_manager.c +++ b/tests/test_connection_manager.c @@ -1432,7 +1432,7 @@ static struct aws_byte_cursor s_get_proxy_host_for_test( return aws_byte_cursor_from_string(host_string); } -static uint16_t s_get_proxy_port_for_test( +static uint32_t s_get_proxy_port_for_test( struct proxy_integration_configurations *configs, enum proxy_test_type proxy_test_type, enum aws_http_proxy_authentication_type auth_type, @@ -1447,7 +1447,7 @@ static uint16_t s_get_proxy_port_for_test( } else { port_string = configs->http_proxy_port; } - return (uint16_t)atoi(aws_string_c_str(port_string)); + return (uint32_t)atoi(aws_string_c_str(port_string)); } static struct aws_string *s_get_proxy_url_for_test( struct proxy_integration_configurations *configs, diff --git a/tests/test_proxy.c b/tests/test_proxy.c index 6a6f3da83..8ad4eba35 100644 --- a/tests/test_proxy.c +++ b/tests/test_proxy.c @@ -22,9 +22,9 @@ static struct proxy_tester tester; static char *s_host_name = "aws.amazon.com"; -static uint16_t s_port = 80; +static uint32_t s_port = 80; static char *s_proxy_host_name = "www.myproxy.hmm"; -static uint16_t s_proxy_port = 777; +static uint32_t s_proxy_port = 777; AWS_STATIC_STRING_FROM_LITERAL(s_mock_request_method, "GET"); AWS_STATIC_STRING_FROM_LITERAL(s_mock_request_path, "/"); diff --git a/tests/test_stream_manager.c b/tests/test_stream_manager.c index 6c4be32f6..68d8a7273 100644 --- a/tests/test_stream_manager.c +++ b/tests/test_stream_manager.c @@ -241,7 +241,7 @@ static int s_tester_init(struct sm_tester_options *options) { } bool use_tls = true; - uint16_t port = 443; + uint32_t port = 443; if (!s_tester.endpoint.scheme.len && (s_tester.endpoint.port == 80 || s_tester.endpoint.port == 3280)) { use_tls = false; } else {