summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucio Franco <luciofranco14@gmail.com>2019-12-05 22:42:44 -0500
committerDoug Tangren <d.tangren@gmail.com>2019-12-05 22:42:44 -0500
commit3cc4515d392e579f8f5293e051c7ddeda14f0498 (patch)
tree3a66e0a9b3eab8c858550b52e1fd943025b6d733
parentdf9e408e4b39729ac22af28628a3ff2c69194d9a (diff)
Replace host str to use https if encrypted (#193)
* Replace host str to use https if encrypted * Add comment and fmt
-rw-r--r--src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e8f9e95..f96915a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -885,6 +885,16 @@ fn get_docker_for_tcp(tcp_host_str: String) -> Docker {
connector.set_ca_file(&Path::new(ca)).unwrap();
}
+ // If we are attempting to connec to the docker daemon via tcp
+ // we need to convert the scheme to `https` to let hyper connect.
+ // Otherwise, hyper will reject the connection since it does not
+ // recongnize `tcp` as a valid `http` scheme.
+ let tcp_host_str = if tcp_host_str.contains("tcp://") {
+ tcp_host_str.replace("tcp://", "https://")
+ } else {
+ tcp_host_str
+ };
+
Docker {
transport: Transport::EncryptedTcp {
client: Client::builder()