mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
5d953184a6
commit
de9ac6c2e5
5 changed files with 30 additions and 7 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue