comparison mercurial/sslutil.py @ 29460:a7d1532b26a1 stable

sslutil: don't access message attribute in exception (issue5285) I should have ran the entire test suite on Python 2.6. Since the hostname matching tests are implemented in Python (not .t tests), it didn't uncover this warning. I'm not sure why - warnings should be printed regardless. This is possibly a bug in the test runner. But that's for another day...
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 02 Jul 2016 09:41:40 -0700
parents 26a5d605b868
children be68a4445041
comparison
equal deleted inserted replaced
29454:ddbff1435e7b 29460:a7d1532b26a1
234 if key == 'DNS': 234 if key == 'DNS':
235 try: 235 try:
236 if _dnsnamematch(value, hostname): 236 if _dnsnamematch(value, hostname):
237 return 237 return
238 except wildcarderror as e: 238 except wildcarderror as e:
239 return e.message 239 return e.args[0]
240 240
241 dnsnames.append(value) 241 dnsnames.append(value)
242 242
243 if not dnsnames: 243 if not dnsnames:
244 # The subject is only checked when there is no DNS in subjectAltName. 244 # The subject is only checked when there is no DNS in subjectAltName.
255 255
256 try: 256 try:
257 if _dnsnamematch(value, hostname): 257 if _dnsnamematch(value, hostname):
258 return 258 return
259 except wildcarderror as e: 259 except wildcarderror as e:
260 return e.message 260 return e.args[0]
261 261
262 dnsnames.append(value) 262 dnsnames.append(value)
263 263
264 if len(dnsnames) > 1: 264 if len(dnsnames) > 1:
265 return _('certificate is for %s') % ', '.join(dnsnames) 265 return _('certificate is for %s') % ', '.join(dnsnames)