diff options
| author | Stephen Moore <stephen@delfick.com> | 2015-11-08 12:17:18 +1100 |
|---|---|---|
| committer | Stephen Moore <stephen@delfick.com> | 2015-11-08 12:18:19 +1100 |
| commit | da3377771ca6b4f3d26d37d01a4a7a5e41066d0c (patch) | |
| tree | fe8adb95f61326efb09741399a8dfd21507ae997 | |
| parent | 881e24c231ab9921eb0cbd475e85706137983f89 (diff) | |
| download | docker-py-da3377771ca6b4f3d26d37d01a4a7a5e41066d0c.tar.gz | |
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 <stephen@delfick.com>
| -rw-r--r-- | docker/ssladapter/ssladapter.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docker/ssladapter/ssladapter.py b/docker/ssladapter/ssladapter.py index 3a70a91..b653b68 100644 --- a/docker/ssladapter/ssladapter.py +++ b/docker/ssladapter/ssladapter.py @@ -46,6 +46,19 @@ class SSLAdapter(HTTPAdapter): self.poolmanager = PoolManager(**kwargs) + def get_connection(self, *args, **kwargs): + """ + Ensure assert_hostname is set correctly on our pool + + We already take care of a normal poolmanager via init_poolmanager + + But we still need to take care of when there is a proxy poolmanager + """ + conn = super(SSLAdapter, self).get_connection(*args, **kwargs) + if conn.assert_hostname != self.assert_hostname: + conn.assert_hostname = self.assert_hostname + return conn + def can_override_ssl_version(self): urllib_ver = urllib3.__version__.split('-')[0] if urllib_ver is None: |
