Issue #14780: urllib.request.urlopen() now has a cadefault argument to use the default certificate store.

Initial patch by James Oakley.
This commit is contained in:
Antoine Pitrou 2012-05-16 21:40:01 +02:00
parent 5d953184a6
commit de9ac6c2e5
5 changed files with 30 additions and 7 deletions

View file

@ -474,6 +474,13 @@ class TestUrlopen(unittest.TestCase):
self.urlopen("https://localhost:%s/bizarre" % handler.port,
cafile=CERT_fakehostname)
def test_https_with_cadefault(self):
handler = self.start_https_server(certfile=CERT_localhost)
# Self-signed cert should fail verification with system certificate store
with self.assertRaises(urllib.error.URLError) as cm:
self.urlopen("https://localhost:%s/bizarre" % handler.port,
cadefault=True)
def test_sending_headers(self):
handler = self.start_server()
req = urllib.request.Request("http://localhost:%s/" % handler.port,