diff options
| author | Benjamin Peterson <benjamin@python.org> | 2014-11-23 17:42:45 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2014-11-23 17:42:45 (GMT) |
| commit | fcfb18ee2b754368ff005a3fec8a9fe7930ccf7d (patch) | |
| tree | d0ec3069e6f10073b55fca4ebf710a8da6123b1f /Lib/test/test_ssl.py | |
| parent | 5f6b89bda3cc9797186c567b6be5c6d8feedb3ec (diff) | |
| download | cpython-fcfb18ee2b754368ff005a3fec8a9fe7930ccf7d.zip cpython-fcfb18ee2b754368ff005a3fec8a9fe7930ccf7d.tar.gz cpython-fcfb18ee2b754368ff005a3fec8a9fe7930ccf7d.tar.bz2 | |
allow passing cert/ssl information to urllib2.urlopen and httplib.HTTPSConnection
This is basically a backport of issues #9003 and #22366.
Diffstat (limited to 'Lib/test/test_ssl.py')
| -rw-r--r-- | Lib/test/test_ssl.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 0c9e24d..36a195e 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -14,7 +14,7 @@ import os import errno import pprint import tempfile -import urllib +import urllib2 import traceback import weakref import platform @@ -2388,10 +2388,11 @@ 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]) + url = 'https://localhost:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) + context = ssl.create_default_context(cafile=CERTFILE) with support.check_py3k_warnings(): - f = urllib.urlopen(url) + f = urllib2.urlopen(url, context=context) try: dlen = f.info().getheader("content-length") if dlen and (int(dlen) > 0): |
