aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters/client_channel/parse_address.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ext/filters/client_channel/parse_address.cc')
-rw-r--r--src/core/ext/filters/client_channel/parse_address.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index 7e726dd562..b94429e207 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -197,3 +197,12 @@ bool grpc_parse_uri(const grpc_uri* uri, grpc_resolved_address* resolved_addr) {
gpr_log(GPR_ERROR, "Can't parse scheme '%s'", uri->scheme);
return false;
}
+
+uint16_t grpc_strhtons(const char* port) {
+ if (strcmp(port, "http") == 0) {
+ return htons(80);
+ } else if (strcmp(port, "https") == 0) {
+ return htons(443);
+ }
+ return htons(static_cast<unsigned short>(atoi(port)));
+}