[ https://issues.apache.org/jira/browse/SCB-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16443736#comment-16443736 ]
ASF GitHub Bot commented on SCB-498: ------------------------------------ liubao68 commented on a change in pull request #651: [SCB-498] Configuration Center ip address need to config default port URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/651#discussion_r182670732 ########## File path: foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java ########## @@ -145,12 +145,25 @@ public static IpPort parseIpPortFromURI(String uriAddress) { try { URI uri = new URI(uriAddress); String authority = uri.getAuthority(); - return parseIpPort(authority); + return parseIpPort(uri.getScheme(), authority); } catch (URISyntaxException e) { return null; } } + private static IpPort parseIpPort(String scheme, String authority) { + if (authority == null) + return null; + int idx = authority.indexOf(':'); + if (idx != -1) + return parseIpPort(authority); + if (scheme.equals("http")) + return parseIpPort(new StringBuffer(authority).append(":80").toString()); + if (scheme.equals("https")) + return parseIpPort(new StringBuffer(authority).append(":443").toString()); + return parseIpPort(authority); Review comment: return null; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Configuration Center IP Addresses need to meet general specifications > --------------------------------------------------------------------- > > Key: SCB-498 > URL: https://issues.apache.org/jira/browse/SCB-498 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Java-Chassis > Reporter: WeiChao > Assignee: WeiChao > Priority: Major > > for http/https, the default ports are 80 and 443. if port is not configured, > the default port needs to be used. this simplifies the configuration. -- This message was sent by Atlassian JIRA (v7.6.3#76005)