Skip to content

Commit 6a1c157

Browse files
authored
Change port from uint16_t to uint32_t, to support VSOCK (#457)
1 parent 2f07551 commit 6a1c157

16 files changed

+29
-29
lines changed

bin/elasticurl/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ int main(int argc, char **argv) {
602602
}
603603

604604
bool use_tls = true;
605-
uint16_t port = 443;
605+
uint32_t port = 443;
606606

607607
if (!app_ctx.uri.scheme.len && (app_ctx.uri.port == 80 || app_ctx.uri.port == 8080)) {
608608
use_tls = false;

include/aws/http/connection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ struct aws_http_client_connection_options {
272272
/**
273273
* Required.
274274
*/
275-
uint16_t port;
275+
uint32_t port;
276276

277277
/**
278278
* Required.

include/aws/http/connection_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct aws_http_connection_manager_options {
8080

8181
const struct aws_http_connection_monitoring_options *monitoring_options;
8282
struct aws_byte_cursor host;
83-
uint16_t port;
83+
uint32_t port;
8484

8585
/**
8686
* Optional.

include/aws/http/http2_stream_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct aws_http2_stream_manager_options {
6868
bool http2_prior_knowledge;
6969

7070
struct aws_byte_cursor host;
71-
uint16_t port;
71+
uint32_t port;
7272

7373
/**
7474
* Optional.

include/aws/http/private/proxy_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct aws_http_proxy_config {
5252

5353
struct aws_byte_buf host;
5454

55-
uint16_t port;
55+
uint32_t port;
5656

5757
struct aws_tls_connection_options *tls_options;
5858

@@ -97,7 +97,7 @@ struct aws_http_proxy_user_data {
9797
* Cached original connect options
9898
*/
9999
struct aws_string *original_host;
100-
uint16_t original_port;
100+
uint32_t original_port;
101101
void *original_user_data;
102102
struct aws_tls_connection_options *original_tls_options;
103103
struct aws_client_bootstrap *original_bootstrap;

include/aws/http/proxy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ struct aws_http_proxy_options {
114114
/**
115115
* Port to make the proxy connection to
116116
*/
117-
uint16_t port;
117+
uint32_t port;
118118

119119
/**
120120
* Optional.

include/aws/http/websocket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct aws_websocket_client_connection_options {
185185
* Optional.
186186
* Defaults to 443 if tls_options is present, 80 if it is not.
187187
*/
188-
uint16_t port;
188+
uint32_t port;
189189

190190
/**
191191
* Required.

source/connection.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static void s_server_bootstrap_on_accept_channel_setup(
506506
if (put_err) {
507507
AWS_LOGF_ERROR(
508508
AWS_LS_HTTP_SERVER,
509-
"%p: %s:%d: Failed to store connection object, error %d (%s).",
509+
"%p: %s:%u: Failed to store connection object, error %d (%s).",
510510
(void *)server,
511511
server->socket->local_endpoint.address,
512512
server->socket->local_endpoint.port,
@@ -519,7 +519,7 @@ static void s_server_bootstrap_on_accept_channel_setup(
519519
/* Tell user of successful connection. */
520520
AWS_LOGF_INFO(
521521
AWS_LS_HTTP_CONNECTION,
522-
"id=%p: " PRInSTR " server connection established at %p %s:%d.",
522+
"id=%p: " PRInSTR " server connection established at %p %s:%u.",
523523
(void *)connection,
524524
AWS_BYTE_CURSOR_PRI(aws_http_version_to_str(connection->http_version)),
525525
(void *)server,
@@ -701,7 +701,7 @@ struct aws_http_server *aws_http_server_new(const struct aws_http_server_options
701701

702702
AWS_LOGF_INFO(
703703
AWS_LS_HTTP_SERVER,
704-
"%p %s:%d: Server setup complete, listening for incoming connections.",
704+
"%p %s:%u: Server setup complete, listening for incoming connections.",
705705
(void *)server,
706706
server->socket->local_endpoint.address,
707707
server->socket->local_endpoint.port);
@@ -751,7 +751,7 @@ void aws_http_server_release(struct aws_http_server *server) {
751751
* s_server_bootstrap_on_server_listener_destroy will be invoked, clean up of the server will be there */
752752
AWS_LOGF_INFO(
753753
AWS_LS_HTTP_SERVER,
754-
"%p %s:%d: Shutting down the server.",
754+
"%p %s:%u: Shutting down the server.",
755755
(void *)server,
756756
server->socket->local_endpoint.address,
757757
server->socket->local_endpoint.port);
@@ -1099,9 +1099,9 @@ int aws_http_client_connect_internal(
10991099

11001100
AWS_LOGF_TRACE(
11011101
AWS_LS_HTTP_CONNECTION,
1102-
"static: attempting to initialize a new client channel to %s:%d",
1102+
"static: attempting to initialize a new client channel to %s:%u",
11031103
aws_string_c_str(host_name),
1104-
(int)options.port);
1104+
options.port);
11051105

11061106
struct aws_socket_channel_bootstrap_options channel_options = {
11071107
.bootstrap = options.bootstrap,

source/connection_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ struct aws_http_connection_manager {
236236
struct aws_string *host;
237237
struct proxy_env_var_settings proxy_ev_settings;
238238
struct aws_tls_connection_options *proxy_ev_tls_options;
239-
uint16_t port;
239+
uint32_t port;
240240
/*
241241
* HTTP/2 specific.
242242
*/

source/proxy_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static struct aws_http_message *s_build_h1_proxy_connect_request(struct aws_http
466466
}
467467

468468
char port_str[20] = "\0";
469-
snprintf(port_str, sizeof(port_str), "%d", (int)user_data->original_port);
469+
snprintf(port_str, sizeof(port_str), "%u", user_data->original_port);
470470
struct aws_byte_cursor port_cursor = aws_byte_cursor_from_c_str(port_str);
471471
if (aws_byte_buf_append(&path_buffer, &port_cursor)) {
472472
goto on_error;

0 commit comments

Comments
 (0)