Add server_hostname to SSL_KEYWORDS
MODIFY
src/urllib3/poolmanager.py
src/urllib3/poolmanager.py
@@ -55,6 +55,7 @@ SSL_KEYWORDS = (
"ca_cert_dir",
"ssl_context",
"key_password",
+ "server_hostname",
)
# Default value for `blocksize` - a new parameter introduced to
# http.client.HTTPConnection & http.client.HTTPSConnection in Python 3.7

MODIFY
test/with_dummyserver/test_poolmanager.py
test/with_dummyserver/test_poolmanager.py
@@ -382,6 +382,11 @@ class TestPoolManager(HTTPDummyServerTestCase):
r = http.request("GET", f"http://{self.host}:{self.port}/")
assert r.status == 200
+ def test_http_with_server_hostname(self) -> None:
+ with PoolManager(server_hostname="example.com") as http:
+ r = http.request("GET", f"http://{self.host}:{self.port}/")
+ assert r.status == 200
+
def test_http_with_ca_cert_dir(self) -> None:
with PoolManager(ca_certs="REQUIRED", ca_cert_dir="/nosuchdir") as http:
r = http.request("GET", f"http://{self.host}:{self.port}/")

Add server_hostname to SSL_KEYWORDS

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>