diff options
author | softprops <d.tangren@gmail.com> | 2015-07-13 01:10:23 -0400 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2015-07-13 01:10:23 -0400 |
commit | dc5b09589cad44534e61a8818a8d1fb1236a7433 (patch) | |
tree | da5f2976e00736e07f6248122de4e6e3c8cbfc59 | |
parent | 558a7720197e30455c79ad3e8ee7371ecb4fdd09 (diff) |
update deps
-rw-r--r-- | Cargo.lock | 34 | ||||
-rw-r--r-- | Cargo.toml | 13 | ||||
-rw-r--r-- | src/bin/shiplft.rs | 12 | ||||
-rw-r--r-- | src/lib.rs | 41 | ||||
-rw-r--r-- | src/transport.rs | 5 |
5 files changed, 68 insertions, 37 deletions
@@ -3,9 +3,9 @@ name = "shiplift" version = "0.1.2" dependencies = [ "httparse 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "jed 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "unix_socket 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -39,22 +39,32 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "hpack" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "httparse" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.5.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cookie 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "solicit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -71,6 +81,11 @@ dependencies = [ ] [[package]] +name = "language-tags" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "lazy_static" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -103,7 +118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mime" -version = "0.0.11" +version = "0.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -166,6 +181,15 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "solicit" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "tempdir" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -11,11 +11,14 @@ keywords = ["docker", "unix", "containers", "hyper", "ship"] license = "MIT" [dependencies] -mime = "0.0.11" -httparse = "0.1.3" -hyper = "0.5.2" +mime = "0.0.12" +httparse = "0.1.4" jed = "0.1.2" openssl = "0.6.2" unix_socket = "0.4.3" -url = "0.2.34" -rustc-serialize = "0.3.15"
\ No newline at end of file +url = "0.2.35" +rustc-serialize = "0.3.15" + +[dependencies.hyper] +version = "0.6.4" +features = ["openssl"]
\ No newline at end of file diff --git a/src/bin/shiplft.rs b/src/bin/shiplft.rs index 0e5dfa8..fa89615 100644 --- a/src/bin/shiplft.rs +++ b/src/bin/shiplft.rs @@ -9,12 +9,12 @@ fn main() { let mut docker = Docker::new(); println!("{:?}", docker.info().unwrap()); - let mut export = OpenOptions::new().write(true).create(true).open("export.tgz").unwrap(); - let mut images = docker.images(); - let mut exported = images.get("nginx").export().unwrap(); - println!("copying"); - copy(&mut exported, &mut export).unwrap(); - println!("copied"); + //let mut export = OpenOptions::new().write(true).create(true).open("export.tgz").unwrap(); + //let mut images = docker.images(); + //let mut exported = images.get("nginx").export().unwrap(); + //println!("copying"); + //copy(&mut exported, &mut export).unwrap(); + //println!("copied"); //let mut containers = docker.containers(); //let stats = containers.get("f527f9be52b2").stats(); @@ -26,8 +26,11 @@ pub mod transport; use builder::{ ContainerBuilder, ContainerListBuilder, Events }; use hyper::{ Client, Url }; +use hyper::net::{ HttpsConnector, Openssl }; use hyper::method::Method; use openssl::x509::X509FileType; +use openssl::ssl::error::SslError; +use openssl::ssl::{ SslContext, SslMethod, SSL_VERIFY_NONE }; use rep::Image as ImageRep; use rep::{ Change, ContainerDetails, Exit, History, @@ -39,6 +42,7 @@ use std::env::{ self, VarError }; use std::io::{ Read, Result }; use std::iter::IntoIterator; use std::path::Path; +use std::sync::Arc; use transport::{ Body, Transport }; use unix_socket::UnixStream; use url::{ Host, RelativeSchemeData, SchemeData }; @@ -304,25 +308,24 @@ impl Docker { }; Docker { transport: Box::new(stream) } }, - _ => { - let mut client = Client::new(); - client.set_ssl_verifier(Box::new(|ssl_ctx| { - match env::var("DOCKER_CERT_PATH").ok() { - Some(ref certs) => { - let cert = &format!("{}/cert.pem", certs); - let key = &format!("{}/key.pem", certs); - ssl_ctx.set_certificate_file(&Path::new(cert), X509FileType::PEM); - ssl_ctx.set_private_key_file(&Path::new(key), X509FileType::PEM); - match env::var("DOCKER_TLS_VERIFY").ok() { - Some(_) => { - let ca = &format!("{}/ca.pem", certs); - ssl_ctx.set_CA_file(&Path::new(ca)); - }, _ => () - }; - () - }, _ => () - } - })); + _ => { + let client = if let Some(ref certs) = env::var("DOCKER_CERT_PATH").ok() { + // fixme: don't unwrap before you know what's in the box + // https://github.com/hyperium/hyper/blob/master/src/net.rs#L427-L428 + let mut ssl_ctx = SslContext::new(SslMethod::Sslv23).unwrap(); + ssl_ctx.set_cipher_list("DEFAULT").unwrap(); + let cert = &format!("{}/cert.pem", certs); + let key = &format!("{}/key.pem", certs); + let _ = ssl_ctx.set_certificate_file(&Path::new(cert), X509FileType::PEM); + let _ = ssl_ctx.set_private_key_file(&Path::new(key), X509FileType::PEM); + if let Some(_) = env::var("DOCKER_TLS_VERIFY").ok() { + let ca = &format!("{}/ca.pem", certs); + let _ = ssl_ctx.set_CA_file(&Path::new(ca)); + }; + Client::with_connector(HttpsConnector::new(Openssl { context: Arc::new(ssl_ctx) })) + } else { + Client::new() + }; let tup = (client, format!("https:{}", domain.to_string())); Docker { transport: Box::new(tup) } } diff --git a/src/transport.rs b/src/transport.rs index 6c97a5a..3157dc2 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -7,8 +7,9 @@ extern crate unix_socket; use hyper::Client; use hyper::client; use self::hyper::buffer::BufReader; -use self::hyper::http::{ parse_response, RawStatus }; -use self::hyper::http::HttpReader::EofReader; +use self::hyper::http::RawStatus; +use self::hyper::http::h1::parse_response; +use self::hyper::http::h1::HttpReader::EofReader; use self::hyper::header::ContentType; use self::hyper::status::StatusCode; use hyper::method::Method; |