Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(61005)

Unified Diff: Lib/test/test_ssl.py

Issue 22417: PEP 476: verify HTTPS certificates by default
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_httplib.py ('k') | Lib/test/test_urllib2_localnet.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_ssl.py Sun Nov 02 22:19:56 2014 +0200
+++ b/Lib/test/test_ssl.py Mon Nov 03 09:50:32 2014 -0800
@@ -2582,9 +2582,10 @@
d1 = f.read()
d2 = ''
# now fetch the same data from the HTTPS server
- url = 'https://%s:%d/%s' % (
- HOST, server.port, os.path.split(CERTFILE)[1])
- f = urllib.request.urlopen(url)
+ url = 'https://localhost:%d/%s' % (
+ server.port, os.path.split(CERTFILE)[1])
+ context = ssl.create_default_context(cafile=CERTFILE)
+ f = urllib.request.urlopen(url, context=context)
try:
dlen = f.info().get("content-length")
if dlen and (int(dlen) > 0):
« no previous file with comments | « Lib/test/test_httplib.py ('k') | Lib/test/test_urllib2_localnet.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+