-function getUrlWithPort (url) {
- const urlObj = urlModule.parse(url)
-
- // Add the port if it is not specified
- if (urlObj.port === null) {
- if (urlObj.protocol === 'http:') {
- return url + ':80'
- } else if (urlObj.protocol === 'https:') {
- return url + ':443'
- } else {
- logger.error('Unknown url protocol: ' + urlObj.protocol)
- return null
- }
+function getHostWithPort (host) {
+ const splitted = host.split(':')
+
+ // The port was not specified
+ if (splitted.length === 1) {
+ if (constants.REMOTE_SCHEME.HTTP === 'https') return host + ':443'
+
+ return host + ':80'