summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-03-17 16:18:37 -0700
committerJoffrey F <joffrey@docker.com>2016-03-17 16:18:37 -0700
commit3168149cbf20b51ac59ea2552a4e9dd7425ed784 (patch)
treec8d75584d7cf56f297f22cb8cd85cc36dbfb5dcb /docker
parent41acd70fd46f0d50516c78843ca739421cb450e4 (diff)
downloaddocker-py-tcp-to-https-parsehost.tar.gz
If tcp host is provided while TLS is enabled, convert to httpstcp-to-https-parsehost
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/utils/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index c5914cf..70fcb1f 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -400,11 +400,12 @@ def parse_host(addr, platform=None, tls=False):
if addr == 'tcp://':
raise errors.DockerException(
- "Invalid bind address format: {0}".format(addr))
+ "Invalid bind address format: {0}".format(addr)
+ )
elif addr.startswith('unix://'):
addr = addr[7:]
elif addr.startswith('tcp://'):
- proto = "http"
+ proto = 'http{0}'.format('s' if tls else '')
addr = addr[6:]
elif addr.startswith('https://'):
proto = "https"