comparison mercurial/debugcommands.py @ 35425:88572b7e50fd stable

debugssl: convert port number to int (issue5757) It doesn't use util.getport(), which may resolve service name to port number.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 14 Dec 2017 22:07:46 +0900
parents 75979c8d4572
children 786289423e97
comparison
equal deleted inserted replaced
35390:7b73bf1a48d4 35425:88572b7e50fd
2084 2084
2085 source, branches = hg.parseurl(ui.expandpath(source)) 2085 source, branches = hg.parseurl(ui.expandpath(source))
2086 url = util.url(source) 2086 url = util.url(source)
2087 addr = None 2087 addr = None
2088 2088
2089 if url.scheme == 'https': 2089 defaultport = {'https': 443, 'ssh': 22}
2090 addr = (url.host, url.port or 443) 2090 if url.scheme in defaultport:
2091 elif url.scheme == 'ssh': 2091 try:
2092 addr = (url.host, url.port or 22) 2092 addr = (url.host, int(url.port or defaultport[url.scheme]))
2093 except ValueError:
2094 raise error.Abort(_("malformed port number in URL"))
2093 else: 2095 else:
2094 raise error.Abort(_("only https and ssh connections are supported")) 2096 raise error.Abort(_("only https and ssh connections are supported"))
2095 2097
2096 from . import win32 2098 from . import win32
2097 2099