aboutsummaryrefslogtreecommitdiff
path: root/urllib3/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'urllib3/connection.py')
-rw-r--r--urllib3/connection.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/urllib3/connection.py b/urllib3/connection.py
index 2a8c359..f64dd1a 100644
--- a/urllib3/connection.py
+++ b/urllib3/connection.py
@@ -38,7 +38,7 @@ except NameError: # Python 2:
from .exceptions import (
ConnectTimeoutError,
SystemTimeWarning,
- SecurityWarning,
+ SubjectAltNameWarning,
)
from .packages.ssl_match_hostname import match_hostname
@@ -192,6 +192,9 @@ class VerifiedHTTPSConnection(HTTPSConnection):
cert_reqs=None, ca_certs=None,
assert_hostname=None, assert_fingerprint=None):
+ if ca_certs and cert_reqs is None:
+ cert_reqs = 'CERT_REQUIRED'
+
self.key_file = key_file
self.cert_file = cert_file
self.cert_reqs = cert_reqs
@@ -245,10 +248,11 @@ class VerifiedHTTPSConnection(HTTPSConnection):
cert = self.sock.getpeercert()
if not cert.get('subjectAltName', ()):
warnings.warn((
- 'Certificate has no `subjectAltName`, falling back to check for a `commonName` for now. '
- 'This feature is being removed by major browsers and deprecated by RFC 2818. '
- '(See https://github.com/shazow/urllib3/issues/497 for details.)'),
- SecurityWarning
+ 'Certificate for {0} has no `subjectAltName`, falling back to check for a '
+ '`commonName` for now. This feature is being removed by major browsers and '
+ 'deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 '
+ 'for details.)'.format(hostname)),
+ SubjectAltNameWarning
)
match_hostname(cert, self.assert_hostname or hostname)