awslabs/aws-c-io

Host cannot be resolved when port is specified

MarcusHellqvist opened this issue · 4 comments

Don't know if this is the correct repo to put this issue on, found it when I used the S3 CRT client. If an endpoint override is set with host:port will gettaddrinfo() not be able to resolve the host since the string isn't splitted and service argument isn't used in the host resolver.

int err_code = getaddrinfo(hostname_cstr, NULL, &hints, &result);

At this level, this is by design. The input structures to the aws-c-* connection primitives assume the URI has already been parsed and split appropriately.

If there is a place higher up in the call chain which is forgetting to turn a URI into its components and properly initialize the individual members, then we should definitely fix that, but we'd need to know where it's happening first.

So this happens when you set the endpoint override like that in the S3 CRT client and call Put/GetObjectAsync which will make a call to aws_s3_client_make_meta_request().

https://sdk.amazonaws.com/cpp/api/LATEST/class_aws_1_1_s3_crt_1_1_client_configuration.html#a50c9ad3236ab28d607dcf58833f861e8

I would open an issue on that C++ SDK repository then as it looks like that override either needs to be treated as a URI or a port option should be added to it.

Ok, will do.