Skip to content
Snippets Groups Projects
Commit e7a523e9 authored by Abhishek Kumar's avatar Abhishek Kumar
Browse files

Merge pull request #951 from rauls5382/service_names

Manually resolve well-known service names
parents 2ba0a978 659be5a1
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment