Skip to content

Commit deb21bc

Browse files
authored
Change log level of CertificateError within match_hostname (urllib3#1657)
1 parent 5b047b6 commit deb21bc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/urllib3/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _match_hostname(cert, asserted_hostname):
429429
try:
430430
match_hostname(cert, asserted_hostname)
431431
except CertificateError as e:
432-
log.error(
432+
log.warning(
433433
"Certificate did not match expected hostname: %s. " "Certificate: %s",
434434
asserted_hostname,
435435
cert,

test/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_match_hostname_mismatch(self):
3232
cert = {"subjectAltName": [("DNS", "foo")]}
3333
asserted_hostname = "bar"
3434
try:
35-
with mock.patch("urllib3.connection.log.error") as mock_log:
35+
with mock.patch("urllib3.connection.log.warning") as mock_log:
3636
_match_hostname(cert, asserted_hostname)
3737
except CertificateError as e:
3838
assert "hostname 'bar' doesn't match 'foo'" in str(e)

0 commit comments

Comments
 (0)