# HG changeset patch # User timeless # Date 1299428827 21600 # Node ID 66d65bccbf065e844e9e279ee325d47076c013be # Parent c17e4d881722cb6e458fa48216ea88f9dea6793e cacert: improve error report when web.cacert file does not exist diff -r c17e4d881722 -r 66d65bccbf06 mercurial/url.py --- a/mercurial/url.py Sun Mar 06 05:56:59 2011 -0600 +++ b/mercurial/url.py Sun Mar 06 10:27:07 2011 -0600 @@ -560,9 +560,13 @@ hostfingerprint = self.ui.config('hostfingerprints', host) if cacerts and not hostfingerprint: + cacerts = util.expandpath(cacerts) + if not os.path.exists(cacerts): + raise util.Abort(_('could not find ' + 'web.cacerts: %s') % cacerts) self.sock = _ssl_wrap_socket(self.sock, self.key_file, self.cert_file, cert_reqs=CERT_REQUIRED, - ca_certs=util.expandpath(cacerts)) + ca_certs=cacerts) msg = _verifycert(self.sock.getpeercert(), host) if msg: raise util.Abort(_('%s certificate error: %s ' diff -r c17e4d881722 -r 66d65bccbf06 tests/test-https.t --- a/tests/test-https.t Sun Mar 06 05:56:59 2011 -0600 +++ b/tests/test-https.t Sun Mar 06 10:27:07 2011 -0600 @@ -96,6 +96,12 @@ $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV $ cat ../hg0.pid >> $DAEMON_PIDS +cacert not found + + $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/ + abort: could not find web.cacerts: no-such.pem + [255] + Test server address cannot be reused $ hg serve -p $HGPORT --certificate=$PRIV 2>&1