summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoey Darwish Dror <roeyd@infinidat.com>2016-12-26 18:08:22 +0200
committerRoey Darwish Dror <roeyd@infinidat.com>2016-12-26 18:08:22 +0200
commit448ea95b4cbfe487501f79f150d87757d724bec8 (patch)
tree2b90364e3f84db186f86172f6d6f4849add28bc2 /src
parent89c99a99c5c52dce85d507d1c13b8d96f66cd9b1 (diff)
Set the Host header
It is currently impossible to create new container. This patch resolves this issue. See the following link for details: https://github.com/docker/docker/issues/20865
Diffstat (limited to 'src')
-rw-r--r--src/transport.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/transport.rs b/src/transport.rs
index 26940f8..0b6a675 100644
--- a/src/transport.rs
+++ b/src/transport.rs
@@ -5,6 +5,7 @@ extern crate mime;
use hyper::Client;
use hyper::client::Body;
+use hyper::header;
use self::super::{Error, Result};
use self::hyper::buffer::BufReader;
use self::hyper::header::ContentType;
@@ -66,6 +67,11 @@ impl Transport {
-> Result<Box<Read>>
where B: Into<Body<'c>>
{
+ let headers = {
+ let mut headers = header::Headers::new();
+ headers.set(header::Host{ hostname: "".to_owned(), port: None });
+ headers
+ };
let req = match *self {
Transport::Tcp { ref client, ref host } => {
client.request(method, &format!("{}{}", host, endpoint)[..])
@@ -73,7 +79,7 @@ impl Transport {
Transport::Unix { ref client, ref path } => {
client.request(method, DomainUrl::new(&path, endpoint))
}
- };
+ }.headers(headers);
let embodied = match body {
Some((b, c)) => req.header(c).body(b),