mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
PEP 476: enable HTTPS certificate verification by default (#22417)
Patch by Alex Gaynor with some modifications by me.
This commit is contained in:
parent
8cf7c1cff0
commit
4ffb075271
11 changed files with 116 additions and 69 deletions
|
@ -2337,9 +2337,10 @@ else:
|
|||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue