Skip to content

Commit da33777

Browse files
committed
Ensure assert_hostname is set on the pool connection
If you have assert_hostname turned off and are using a proxy on your computer then assert_hostname wasn't being properly set on the pool connection and it was failing to connect to docker Signed-off-by: Stephen Moore <[email protected]>
1 parent 881e24c commit da33777

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docker/ssladapter/ssladapter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ def init_poolmanager(self, connections, maxsize, block=False):
4646

4747
self.poolmanager = PoolManager(**kwargs)
4848

49+
def get_connection(self, *args, **kwargs):
50+
"""
51+
Ensure assert_hostname is set correctly on our pool
52+
53+
We already take care of a normal poolmanager via init_poolmanager
54+
55+
But we still need to take care of when there is a proxy poolmanager
56+
"""
57+
conn = super(SSLAdapter, self).get_connection(*args, **kwargs)
58+
if conn.assert_hostname != self.assert_hostname:
59+
conn.assert_hostname = self.assert_hostname
60+
return conn
61+
4962
def can_override_ssl_version(self):
5063
urllib_ver = urllib3.__version__.split('-')[0]
5164
if urllib_ver is None:

0 commit comments

Comments
 (0)