diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c index 989b968ae27..85085dc37d1 100644 --- a/src/core/iomgr/resolve_address_posix.c +++ b/src/core/iomgr/resolve_address_posix.c @@ -101,6 +101,21 @@ grpc_resolved_addresses *grpc_blocking_resolve_address( hints.ai_flags = AI_PASSIVE; /* for wildcard IP address */ s = getaddrinfo(host, port, &hints, &result); + if (s != 0) { + /* Retry if well-known service name is recognized */ + char *svc[][2] = { + {"http", "80"}, + {"https", "443"} + }; + int i; + for (i = 0; i < (int)(sizeof(svc) / sizeof(svc[0])); i++) { + if (!strcmp(port, svc[i][0])) { + s = getaddrinfo(host, svc[i][1], &hints, &result); + break; + } + } + } + if (s != 0) { gpr_log(GPR_ERROR, "getaddrinfo: %s", gai_strerror(s)); goto done;