summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-05 21:17:29 (GMT)
committerGeorg Brandl <georg@python.org>2014-11-05 21:17:29 (GMT)
commitdca213dd776c3b30330279f7b93c99c863b044d2 (patch)
tree3b10db1915d63d39c7151ed3ee89798bbbfe43a0
parentf25358265a396951af732ad73eef4688783328d9 (diff)
parentfbaf9310965f5ea491b9ed7b1b6e5db4f73e4def (diff)
downloadcpython-dca213dd776c3b30330279f7b93c99c863b044d2.zip
cpython-dca213dd776c3b30330279f7b93c99c863b044d2.tar.gz
cpython-dca213dd776c3b30330279f7b93c99c863b044d2.tar.bz2
merge with 3.4
-rw-r--r--Lib/test/selfsigned_pythontestdotnet.pem16
-rw-r--r--Lib/test/test_httplib.py20
2 files changed, 24 insertions, 12 deletions
diff --git a/Lib/test/selfsigned_pythontestdotnet.pem b/Lib/test/selfsigned_pythontestdotnet.pem
new file mode 100644
index 0000000..9a80073
--- /dev/null
+++ b/Lib/test/selfsigned_pythontestdotnet.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIChzCCAfCgAwIBAgIJAKGU95wKR8pSMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
+A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
+b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
+aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
+Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
+Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjKTAnMCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MA0GCSqGSIb3DQEBBQUAA4GBAIOXmdtM
+eG9qzP9TiXW/Gc/zI4cBfdCpC+Y4gOfC9bQUC7hefix4iO3+iZjgy3X/FaRxUUoV
+HKiXcXIaWqTSUWp45cSh0MbwZXudp6JIAptzdAhvvCrPKeC9i9GvxsPD4LtDAL97
+vSaxQBezA7hdxZd90/EeyMgVZgAnTCnvAWX9
+-----END CERTIFICATE-----
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 8142c0e..93c2212 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -15,8 +15,8 @@ here = os.path.dirname(__file__)
CERT_localhost = os.path.join(here, 'keycert.pem')
# Self-signed cert file for 'fakehostname'
CERT_fakehostname = os.path.join(here, 'keycert2.pem')
-# Root cert file (CA) for svn.python.org's cert
-CACERT_svn_python_org = os.path.join(here, 'https_svn_python_org_root.pem')
+# Self-signed cert file for self-signed.pythontest.net
+CERT_selfsigned_pythontestdotnet = os.path.join(here, 'selfsigned_pythontestdotnet.pem')
# constants for testing chunked encoding
chunked_start = (
@@ -1006,11 +1006,6 @@ class HTTPSTest(TestCase):
h = client.HTTPSConnection(HOST, TimeoutTest.PORT, timeout=30)
self.assertEqual(h.timeout, 30)
- def _check_svn_python_org(self, resp):
- # Just a simple check that everything went fine
- server_string = resp.getheader('server')
- self.assertIn('Apache', server_string)
-
def test_networked(self):
# Default settings: requires a valid cert from a trusted CA
import ssl
@@ -1044,17 +1039,18 @@ class HTTPSTest(TestCase):
self.assertIn('text/html', content_type)
def test_networked_good_cert(self):
- # We feed a CA cert that validates the server's cert
+ # We feed the server's cert as a validating cert
import ssl
support.requires('network')
- with support.transient_internet('svn.python.org'):
+ with support.transient_internet('self-signed.pythontest.net'):
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.verify_mode = ssl.CERT_REQUIRED
- context.load_verify_locations(CACERT_svn_python_org)
- h = client.HTTPSConnection('svn.python.org', 443, context=context)
+ context.load_verify_locations(CERT_selfsigned_pythontestdotnet)
+ h = client.HTTPSConnection('self-signed.pythontest.net', 443, context=context)
h.request('GET', '/')
resp = h.getresponse()
- self._check_svn_python_org(resp)
+ server_string = resp.getheader('server')
+ self.assertIn('nginx', server_string)
def test_networked_bad_cert(self):
# We feed a "CA" cert that is unrelated to the server's cert