From 566a206284168e5e57deaddbdebf82807f61dc2d Mon Sep 17 00:00:00 2001 From: "Y. T. Chung" Date: Mon, 6 Feb 2017 10:31:50 +0800 Subject: [PATCH] updated dependencies and impl --- Cargo.lock | 423 ++++++++++++------------------- Cargo.toml | 14 +- src/bin/server.rs | 14 +- src/crypto/cipher.rs | 62 ++--- src/crypto/mod.rs | 2 +- src/crypto/openssl.rs | 18 +- src/relay/tcprelay/http_local.rs | 138 +++++----- 7 files changed, 287 insertions(+), 384 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26815af8..bed132d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,37 +1,42 @@ [root] name = "shadowsocks-rust" -version = "1.0.2" +version = "1.0.3" dependencies = [ - "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.19.3 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.20.3 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "ip 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "qrcode 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", + "qrcode 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "adler32" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "aho-corasick" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -39,21 +44,11 @@ name = "ansi_term" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bitflags" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "byteorder" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byteorder" version = "1.0.0" @@ -66,15 +61,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "clap" -version = "2.19.3" +version = "2.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term_size 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -84,22 +79,20 @@ name = "color_quant" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cookie" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "deflate" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "deque" version = "0.3.1" @@ -118,25 +111,21 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "flate2" -version = "0.2.14" +name = "error-chain" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "futures" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -148,13 +137,13 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gcc" -version = "0.3.41" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -180,14 +169,6 @@ name = "glob" version = "0.2.11" 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.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "httparse" version = "1.2.1" @@ -195,24 +176,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.9.14" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (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)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -222,15 +200,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "image" -version = "0.10.4" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "gif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -238,7 +216,7 @@ dependencies = [ "num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "png 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -287,17 +265,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "libressl-pnacl-sys" -version = "2.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "linked-hash-map" version = "0.2.1" @@ -328,10 +298,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memchr" -version = "0.1.11" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "metadeps" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -342,34 +322,24 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "miniz-sys" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "mio" -version = "0.6.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miow" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -385,35 +355,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "nix" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-bigint" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num-integer" version = "0.1.32" @@ -436,10 +382,8 @@ name = "num-rational" version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-bigint 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -452,93 +396,53 @@ name = "num_cpus" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "openssl" -version = "0.8.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.7.17" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "openssl-sys-extras" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "openssl-verify" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "pkg-config" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "pnacl-build-helper" -version = "1.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "png" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "inflate 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "qrcode" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "image 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -547,7 +451,7 @@ name = "rand" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -556,26 +460,31 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_syscall" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "regex" -version = "0.1.80" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.3.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -583,11 +492,11 @@ name = "rust-crypto" version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -623,77 +532,67 @@ name = "slab" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "solicit" -version = "0.4.4" -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.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "strsim" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "tempdir" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "term_size" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread-id" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" -version = "0.2.7" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-core" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "toml" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "traitobject" version = "0.0.1" @@ -722,12 +621,12 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-segmentation" -version = "0.1.3" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -735,9 +634,17 @@ name = "unicode-width" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unreachable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "url" -version = "1.2.4" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -755,7 +662,7 @@ dependencies = [ [[package]] name = "utf8-ranges" -version = "0.1.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -788,32 +695,30 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +"checksum adler32 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57be033eb4100070a93a9400a725839cda9c415244f808b0357e72b9e003d5ba" +"checksum aho-corasick 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f660b942762979b56c9f07b4b36bb559776fbad102f05d6771e1b629e8fd5bf" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" -"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" -"checksum clap 2.19.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95b78f3fe0fc94c13c731714363260e04b557a637166f33a4570d3189d642374" +"checksum clap 2.20.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f89819450aa94325998aa83ce7ea142db11ad24c725d6bc48459845e0d6d9f18" "checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d" -"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626" "checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97" +"checksum deflate 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "24c5f3de3a8e183ab9a169654b652407e5e80bed40986bcca92c2b088b9bfa80" "checksum deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1614659040e711785ed8ea24219140654da1729f3ec8a47a9719d041112fe7bf" "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" -"checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" -"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" -"checksum futures 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3e0b237aed5d8b61bc7d6ee1b8ebd719d0a934a38d363c5e56daf34bb634d9b2" +"checksum env_logger 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "99971fb1b635fe7a0ee3c4d065845bb93cca80a23b5613b5613391ece5de4144" +"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f" +"checksum futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "c1913eb7083840b1bbcbf9631b7fda55eaf35fe7ead13cca034e8946f9e2bc41" "checksum futures-cpupool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bb982bb25cd8fa5da6a8eb3a460354c984ff1113da82bcb4f0b0862b5795db82" -"checksum gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)" = "3689e1982a563af74960ae3a4758aa632bb8fd984cfc3cc3b60ee6109477ab6e" +"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" "checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" "checksum gif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01c7c19a035de94bd7afbaa62c241aadfbdf1a70f560b348d2312eafa566ca16" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" "checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d" -"checksum hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)" = "bcb3fc65554155980167fb821d05c7c66177f92464976c0b676a19d9e03387a7" +"checksum hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "220407e5a263f110ec30a071787c9535918fdfc97def5680c90013c3f30c38c1" "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" -"checksum image 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "76df2dce95fef56fd35dbc41c36e37b19aede703c6be7739e8b65d5788ffc728" +"checksum image 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fb38e372d9288be8fa60bea6f05342e4a35244c221cd9fe4c01ded02c86e60c" "checksum inflate 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e0062d2dc2f17d2f13750d95316ae8a2ff909af0fda957084f5defd87c43bb" "checksum ip 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7349baf09910ffb475d8ea8a16f1bbe5ec2be295373feef33fb4fea658b8a0ef" "checksum jpeg-decoder 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "5c4ff3d14e7ef3522471ab712832c3dd50001f7fb7aa4cdc48af811d63b531e9" @@ -821,39 +726,33 @@ dependencies = [ "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" "checksum lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce12306c4739d86ee97c23139f3a34ddf0387bbf181bc7929d287025a8c3ef6b" -"checksum libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9e030dc72013ed68994d1b2cbf36a94dd0e58418ba949c4b0db7eeb70a7a6352" -"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71" +"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" "checksum linked-hash-map 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bda158e0dabeb97ee8a401f4d17e479d6b891a14de0bba79d5cc2d4d325b5e48" "checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" "checksum lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "656fa4dfcb02bcf1063c592ba3ff6a5303ee1f2afe98c8a889e8b1a77c6dfdb7" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" -"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" +"checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151" "checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66" -"checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" -"checksum mio 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5b493dc9fd96bd2077f2117f178172b0765db4dfda3ea4d8000401e6d65d3e80" -"checksum miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3e690c5df6b2f60acd45d56378981e827ff8295562fc8d34f573deb267a59cd1" +"checksum mio 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "eecdbdd49a849336e77b453f021c89972a2cfb5b51931a0026ae0ac4602de681" +"checksum miow 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a78d2605eb97302c10cf944b8d96b0a2a890c52957caf92fcd1f24f69049579" "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" -"checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" -"checksum num-bigint 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "88b14378471f7c2adc5262f05b4701ef53e8da376453a8d8fee48e51db745e49" "checksum num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "fb24d9bfb3f222010df27995441ded1e954f8f69cd35021f6bef02ca9552fb92" "checksum num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "287a1c9969a847055e1122ec0ea7a5c5d6f72aad97934e131c83d5c08ab4e45c" "checksum num-rational 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "54ff603b8334a72fbb27fe66948aac0abaaa40231b3cecd189e76162f6f38aaf" "checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" "checksum num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a225d1e2717567599c24f88e49f00856c6e825a12125181ee42c4257e3688d39" -"checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733" -"checksum openssl 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b11754cb6c81bb9e62faaf0eb6d94dde2aab0928c04db5078b74242880f35eb1" -"checksum openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f" -"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa" -"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d" -"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" -"checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b" -"checksum png 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "06208e2ee243e3118a55dda9318f821f206d8563fb8d4df258767f8e62bb0997" -"checksum qrcode 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49f22e5d95b26cfef3b2b813f1a33ed427e217feb3a6d1a2d853d90861eb37cd" +"checksum openssl 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0c00da69323449142e00a5410f0e022b39e8bbb7dc569cee8fc6af279279483c" +"checksum openssl-sys 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b1482f9a06f56c906007e17ea14d73d102210b5d27bc948bf5e175f493f3f7c3" +"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum png 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3cb773e9a557edb568ce9935cf783e3cdcabe06a9449d41b3e5506d88e582c82" +"checksum qrcode 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "742c7dc3bdcbc5edde8f2e9c273518d47ac584e00c2f0fbf51d982394296c1a6" "checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" "checksum rayon 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50c575b58c2b109e2fbc181820cbe177474f35610ff9e357dc75f6bac854ffbf" -"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" +"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753" +"checksum regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4278c17d0f6d62dfef0ab00028feb45bd7d2102843f80763474eeb1be8a10c01" +"checksum regex-syntax 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9191b1f57603095f105d317e375d19b1c9c5c3185ea9633a99a6dcbed04457" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" @@ -861,24 +760,24 @@ dependencies = [ "checksum scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef399c8893e8cb7aa9696e895427fab3a6bf265977bb96e126f24ddd2cda85a" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" -"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2" -"checksum strsim 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "67f84c44fbb2f91db7fef94554e6b2ac05909c9c0b0bc23bb98d3a1aebfe7f7c" -"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" -"checksum term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f7f5f3f71b0040cecc71af239414c23fd3c73570f5ff54cf50e03cef637f2a0" -"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" -"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" -"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af" -"checksum tokio-core 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0800e9475303171ffbc79394079ef503b6d00949649799208f4fc8f1eca20892" +"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694" +"checksum term_size 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "71662702fe5cd2cf95edd4ad655eea42f24a87a0e44059cbaa4e55260b7bc331" +"checksum thread-id 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4437c97558c70d129e40629a5b385b3fb1ffac301e63941335e4d354081ec14a" +"checksum thread_local 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7793b722f0f77ce716e7f1acf416359ca32ff24d04ffbac4269f44a4a83be05d" +"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade" +"checksum tokio-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3d1be481b55126f02ef88ff86748086473cb537a949fc4a8f4be403a530ae54b" +"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" "checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764" "checksum unicode-bidi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b61814f3e7fd0e0f15370f767c7c943e08bc2e3214233ae8f88522b334ceb778" -"checksum unicode-normalization 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5e94e9f6961090fcc75180629c4ef33e5310d6ed2c0dd173f4ca63c9043b669e" -"checksum unicode-segmentation 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c3bc443ded17b11305ffffe6b37e2076f328a5a8cb6aa877b1b98f77699e98b5" +"checksum unicode-normalization 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e28fa37426fceeb5cf8f41ee273faa7c82c47dc8fba5853402841e665fcd86ff" +"checksum unicode-segmentation 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c5336c5173d8a77ae0b36151c706e32ae10f4985e29d704ad5b5f9565d6d4b6" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" -"checksum url 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f024e241a55f5c88401595adc1d4af0c9649e91da82d0e190fe55950231ae575" +"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" +"checksum url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5ba8a749fb4479b043733416c244fa9d1d3af3d7c23804944651c8a448cb87e" "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" -"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" "checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 1cc0e3bf..86dcf649 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shadowsocks-rust" -version = "1.0.2" +version = "1.0.3" authors = ["Y. T. CHUNG "] description = "shadowsocks is a fast tunnel proxy that helps you bypass firewalls." repository = "https://github.com/zonyitoo/shadowsocks-rust" @@ -42,20 +42,20 @@ path = "src/bin/ssurl.rs" [dependencies] rustc-serialize = "0.3" log = "0.3" -byteorder = "0.5" +byteorder = "1.0" rand = "0.3" time = "0.1" clap = "2" qrcode = "0.2" -env_logger = "0.3" +env_logger = "0.4" rust-crypto = "0.2" ip = "1" -openssl = "0.8" +openssl = "0.9" lru-cache = "0.1" libc = "0.2" -hyper = "0.9" -url = "1.2" -httparse = "1.1" +hyper = "0.10" +url = "1.4" +httparse = "1.2" futures = "0.1" futures-cpupool = "0.1" tokio-core = "0.1" diff --git a/src/bin/server.rs b/src/bin/server.rs index 521739ea..694e9bdd 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -99,7 +99,8 @@ fn main() { let mut log_builder = LogBuilder::new(); log_builder.filter(None, LogLevelFilter::Info); - match matches.occurrences_of("VERBOSE") { + let debug_level = matches.occurrences_of("VERBOSE"); + match debug_level { 0 => { // Default filter log_builder.format(|record: &LogRecord| { @@ -130,6 +131,17 @@ fn main() { log_builder.filter(Some("ssserver"), LogLevelFilter::Debug) .filter(Some("shadowsocks"), LogLevelFilter::Debug); } + 3 => { + let mut log_builder = log_builder.format(|record: &LogRecord| { + format!("[{}][{}] [{}] {}", + time::now().strftime("%Y-%m-%d][%H:%M:%S").unwrap(), + record.level(), + record.location().module_path(), + record.args()) + }); + log_builder.filter(Some("ssserver"), LogLevelFilter::Trace) + .filter(Some("shadowsocks"), LogLevelFilter::Trace); + } _ => { let mut log_builder = log_builder.format(|record: &LogRecord| { format!("[{}][{}] [{}] {}", diff --git a/src/crypto/cipher.rs b/src/crypto/cipher.rs index 6e08311e..5f2946db 100644 --- a/src/crypto/cipher.rs +++ b/src/crypto/cipher.rs @@ -36,7 +36,7 @@ use crypto::crypto::CryptoCipher; use crypto::digest::{self, DigestType, Digest}; -use openssl::crypto::symm; +use openssl::symm; /// Basic operation of Cipher, which is a Symmetric Cipher. /// @@ -168,24 +168,24 @@ impl CipherType { CipherType::Dummy => 0, #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb => symm::Type::AES_128_CFB128.block_size(), + CipherType::Aes128Cfb => symm::Cipher::aes_128_cfb128().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb1 => symm::Type::AES_128_CFB1.block_size(), + CipherType::Aes128Cfb1 => symm::Cipher::aes_128_cfb1().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb8 => symm::Type::AES_128_CFB8.block_size(), + CipherType::Aes128Cfb8 => symm::Cipher::aes_128_cfb8().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb128 => symm::Type::AES_128_CFB128.block_size(), + CipherType::Aes128Cfb128 => symm::Cipher::aes_128_cfb128().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb => symm::Type::AES_256_CFB128.block_size(), + CipherType::Aes256Cfb => symm::Cipher::aes_256_cfb128().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb1 => symm::Type::AES_256_CFB1.block_size(), + CipherType::Aes256Cfb1 => symm::Cipher::aes_256_cfb1().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb8 => symm::Type::AES_256_CFB8.block_size(), + CipherType::Aes256Cfb8 => symm::Cipher::aes_256_cfb8().block_size(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb128 => symm::Type::AES_256_CFB128.block_size(), + CipherType::Aes256Cfb128 => symm::Cipher::aes_256_cfb128().block_size(), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Type::RC4_128.block_size(), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Type::RC4_128.block_size(), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Cipher::rc4().block_size(), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Cipher::rc4().block_size(), #[cfg(feature = "cipher-chacha20")] CipherType::ChaCha20 => 8, #[cfg(feature = "cipher-salsa20")] CipherType::Salsa20 => 8, @@ -199,24 +199,24 @@ impl CipherType { CipherType::Dummy => 0, #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb => symm::Type::AES_128_CFB128.key_len(), + CipherType::Aes128Cfb => symm::Cipher::aes_128_cfb128().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb1 => symm::Type::AES_128_CFB1.key_len(), + CipherType::Aes128Cfb1 => symm::Cipher::aes_128_cfb1().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb8 => symm::Type::AES_128_CFB8.key_len(), + CipherType::Aes128Cfb8 => symm::Cipher::aes_128_cfb8().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb128 => symm::Type::AES_128_CFB128.key_len(), + CipherType::Aes128Cfb128 => symm::Cipher::aes_128_cfb128().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb => symm::Type::AES_256_CFB128.key_len(), + CipherType::Aes256Cfb => symm::Cipher::aes_256_cfb128().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb1 => symm::Type::AES_256_CFB1.key_len(), + CipherType::Aes256Cfb1 => symm::Cipher::aes_256_cfb1().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb8 => symm::Type::AES_256_CFB8.key_len(), + CipherType::Aes256Cfb8 => symm::Cipher::aes_256_cfb8().key_len(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb128 => symm::Type::AES_256_CFB128.key_len(), + CipherType::Aes256Cfb128 => symm::Cipher::aes_256_cfb128().key_len(), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Type::RC4_128.key_len(), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Type::RC4_128.key_len(), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Cipher::rc4().key_len(), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Cipher::rc4().key_len(), #[cfg(feature = "cipher-chacha20")] CipherType::ChaCha20 => 32, #[cfg(feature = "cipher-salsa20")] CipherType::Salsa20 => 32, @@ -259,24 +259,24 @@ impl CipherType { CipherType::Dummy => 0, #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb => symm::Type::AES_128_CFB128.iv_len().unwrap_or(0), + CipherType::Aes128Cfb => symm::Cipher::aes_128_cfb128().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb1 => symm::Type::AES_128_CFB1.iv_len().unwrap_or(0), + CipherType::Aes128Cfb1 => symm::Cipher::aes_128_cfb1().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb8 => symm::Type::AES_128_CFB8.iv_len().unwrap_or(0), + CipherType::Aes128Cfb8 => symm::Cipher::aes_128_cfb8().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb128 => symm::Type::AES_128_CFB128.iv_len().unwrap_or(0), + CipherType::Aes128Cfb128 => symm::Cipher::aes_128_cfb128().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb => symm::Type::AES_256_CFB128.iv_len().unwrap_or(0), + CipherType::Aes256Cfb => symm::Cipher::aes_256_cfb128().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb1 => symm::Type::AES_256_CFB1.iv_len().unwrap_or(0), + CipherType::Aes256Cfb1 => symm::Cipher::aes_256_cfb1().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb8 => symm::Type::AES_256_CFB8.iv_len().unwrap_or(0), + CipherType::Aes256Cfb8 => symm::Cipher::aes_256_cfb8().iv_len().unwrap_or(0), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb128 => symm::Type::AES_256_CFB128.iv_len().unwrap_or(0), + CipherType::Aes256Cfb128 => symm::Cipher::aes_256_cfb128().iv_len().unwrap_or(0), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Type::RC4_128.iv_len().unwrap_or(0), - #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Type::RC4_128.iv_len().unwrap_or(0), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4 => symm::Cipher::rc4().iv_len().unwrap_or(0), + #[cfg(feature = "cipher-rc4")] CipherType::Rc4Md5 => symm::Cipher::rc4().iv_len().unwrap_or(0), #[cfg(feature = "cipher-chacha20")] CipherType::ChaCha20 => 8, #[cfg(feature = "cipher-salsa20")] CipherType::Salsa20 => 8, diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs index b6755a5c..37b787a7 100644 --- a/src/crypto/mod.rs +++ b/src/crypto/mod.rs @@ -24,7 +24,7 @@ use std::convert::From; -use openssl::crypto::symm; +use openssl::symm; pub use self::cipher::{CipherType, Cipher, CipherVariant, CipherResult}; diff --git a/src/crypto/openssl.rs b/src/crypto/openssl.rs index 6f151d48..f0096534 100644 --- a/src/crypto/openssl.rs +++ b/src/crypto/openssl.rs @@ -28,11 +28,11 @@ use crypto::cipher; use crypto::CryptoMode; -use openssl::crypto::symm; +use openssl::symm; /// Core cipher of OpenSSL pub struct OpenSSLCrypto { - cipher: symm::Type, + cipher: symm::Cipher, inner: symm::Crypter, } @@ -41,20 +41,20 @@ impl OpenSSLCrypto { pub fn new(cipher_type: cipher::CipherType, key: &[u8], iv: &[u8], mode: CryptoMode) -> OpenSSLCrypto { let t = match cipher_type { #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes128Cfb => symm::Type::AES_128_CFB128, + CipherType::Aes128Cfb => symm::Cipher::aes_128_cfb128(), #[cfg(feature = "cipher-aes-cfb1")] - CipherType::Aes128Cfb1 => symm::Type::AES_128_CFB1, + CipherType::Aes128Cfb1 => symm::Cipher::aes_128_cfb1(), #[cfg(feature = "cipher-aes-cfb128")] - CipherType::Aes128Cfb128 => symm::Type::AES_128_CFB128, + CipherType::Aes128Cfb128 => symm::Cipher::aes_128_cfb128(), #[cfg(feature = "cipher-aes-cfb")] - CipherType::Aes256Cfb => symm::Type::AES_256_CFB128, + CipherType::Aes256Cfb => symm::Cipher::aes_256_cfb128(), #[cfg(feature = "cipher-aes-cfb1")] - CipherType::Aes256Cfb1 => symm::Type::AES_256_CFB1, + CipherType::Aes256Cfb1 => symm::Cipher::aes_256_cfb1(), #[cfg(feature = "cipher-aes-cfb128")] - CipherType::Aes256Cfb128 => symm::Type::AES_256_CFB128, + CipherType::Aes256Cfb128 => symm::Cipher::aes_256_cfb128(), #[cfg(feature = "cipher-rc4")] - CipherType::Rc4 => symm::Type::RC4_128, + CipherType::Rc4 => symm::Cipher::rc4(), _ => { panic!("Cipher type {:?} does not supported by OpenSSLCrypt yet", cipher_type) diff --git a/src/relay/tcprelay/http_local.rs b/src/relay/tcprelay/http_local.rs index 2ac0e398..241cdc39 100644 --- a/src/relay/tcprelay/http_local.rs +++ b/src/relay/tcprelay/http_local.rs @@ -21,7 +21,7 @@ /// Http Proxy -use std::io::{self, Read, Write}; +use std::io::{self, BufRead, BufReader, Write}; use std::net::{SocketAddr, SocketAddrV4, SocketAddrV6}; use std::mem; use std::str; @@ -293,14 +293,14 @@ impl HeaderFormat for XRealIp { /// Future for reading HttpRequest pub enum HttpRequestFut - where R: Read + where R: BufRead { Pending { r: R, buf: Vec }, Empty, } impl HttpRequestFut - where R: Read + where R: BufRead { pub fn new(r: R) -> HttpRequestFut { HttpRequestFut::with_buf(r, Vec::new()) @@ -312,21 +312,29 @@ impl HttpRequestFut } impl Future for HttpRequestFut - where R: Read + where R: BufRead { - type Item = (R, HttpRequest, Vec); + type Item = (R, HttpRequest); type Error = io::Error; fn poll(&mut self) -> Poll { - let mut lbuf = [0u8; 4096]; - let (req, len) = match self { + let req = match self { &mut HttpRequestFut::Pending { ref mut r, ref mut buf } => { // FIXME: Compiler force me to do this! let http_req: Option; - let total_len: usize; loop { - let n = try_nb!(r.read(&mut lbuf)); - buf.extend_from_slice(&lbuf[..n]); + let mut is_eof = false; + loop { + let n = try_nb!(r.read_until(b'\n', buf)); + if n == 0 { + is_eof = true; + break; + } + + if buf.ends_with(b"\r\n\r\n") { + break; + } + } // Maximum 128 headers let mut headers = [httparse::EMPTY_HEADER; 128]; @@ -334,14 +342,13 @@ impl Future for HttpRequestFut let mut req = Request::new(&mut headers); match req.parse(&mut buf[..]) { Ok(httparse::Status::Partial) => { - if n == 0 { + if is_eof { // Already EOF! let err = io::Error::new(io::ErrorKind::UnexpectedEof, "Unexpected Eof"); return Err(err); } } - Ok(httparse::Status::Complete(len)) => { - total_len = len; + Ok(httparse::Status::Complete(..)) => { // Make borrow checker happy let headers_ref = unsafe { &*headers_ptr }; @@ -364,13 +371,13 @@ impl Future for HttpRequestFut } } - (http_req.unwrap(), total_len) + http_req.unwrap() } &mut HttpRequestFut::Empty => panic!("poll a HttpRequestFut after it's done"), }; match mem::replace(self, HttpRequestFut::Empty) { - HttpRequestFut::Pending { r, buf } => Ok((r, req, buf[len..].to_vec()).into()), + HttpRequestFut::Pending { r, .. } => Ok((r, req).into()), HttpRequestFut::Empty => unreachable!(), } } @@ -383,15 +390,8 @@ fn socket_to_ip(addr: &SocketAddr) -> IpAddr { } } -/// Proxy this HTTP Request to writer -pub fn proxy_request_encrypted((r, w): (R, EncryptedWriter), - client_addr: Option<&SocketAddr>, - mut req: HttpRequest, - mut remains: Vec) - -> BoxIoFuture<(R, EncryptedWriter, Vec)> - where R: Read + 'static, - W: Write + 'static -{ +fn preprocess_request(client_addr: Option<&SocketAddr>, req: &mut HttpRequest) -> usize { + // Gets content length for body let content_length = req.headers.get::().unwrap_or(&ContentLength(0)).0 as usize; if let Some(client_addr) = client_addr { @@ -414,23 +414,22 @@ pub fn proxy_request_encrypted((r, w): (R, EncryptedWriter), // Clears host, which only for proxy req.clear_request_uri_host(); + content_length +} + +/// Proxy this HTTP Request to writer +pub fn proxy_request_encrypted((r, w): (R, EncryptedWriter), + client_addr: Option<&SocketAddr>, + mut req: HttpRequest) + -> BoxIoFuture<(R, EncryptedWriter)> + where R: BufRead + 'static, + W: Write + 'static +{ + let content_length = preprocess_request(client_addr, &mut req); + let fut = req.write_to_encrypted(w) .and_then(|w| flush(w)) - .and_then(move |w| { - if content_length == 0 { - boxed_future(futures::finished((r, w, remains))) - } else if content_length <= remains.len() { - let after_that = remains.split_off(content_length); - boxed_future(w.write_all_encrypted(remains).map(|(w, _)| (r, w, after_that))) - } else { - let missing_bytes = content_length - remains.len(); - let fut = w.write_all_encrypted(remains) - .and_then(move |(w, _)| { - super::copy_exact_encrypted(r, w, missing_bytes).map(|(r, w)| (r, w, vec![])) - }); - boxed_future(fut) - } - }); + .and_then(move |w| super::copy_exact_encrypted(r, w, content_length)); Box::new(fut) } @@ -452,10 +451,9 @@ pub fn should_keep_alive(req: &HttpRequest) -> bool { } fn handle_connect(handle: Handle, - (r, w): (ReadHalf, WriteHalf), + (r, w): (BufReader>, WriteHalf), req: HttpRequest, addr: Address, - remains: Vec, svr_cfg: Rc) -> Box> { let cloned_addr = addr.clone(); @@ -474,11 +472,9 @@ fn handle_connect(handle: Handle, .map(|w| (svr_s, w)) }) .and_then(move |(svr_s, w)| { - super::proxy_server_handshake(svr_s, cloned_svr_cfg, addr).and_then(|(svr_r, svr_w)| { + super::proxy_server_handshake(svr_s, cloned_svr_cfg, addr).and_then(move |(svr_r, svr_w)| { let rhalf = svr_r.and_then(move |svr_r| copy(svr_r, w)); - let whalf = svr_w.and_then(move |svr_w| svr_w.write_all_encrypted(remains)) - .and_then(move |(svr_w, _)| svr_w.copy_from_encrypted(r)); - + let whalf = svr_w.and_then(move |svr_w| svr_w.copy_from_encrypted(r)); tunnel(cloned_addr, whalf, rhalf) }) }); @@ -486,22 +482,21 @@ fn handle_connect(handle: Handle, Box::new(fut) } -fn handle_http_keepalive(r: ReadHalf, svr_w: super::EncryptedHalf, req_remains: Vec) -> BoxIoFuture<()> { - let fut = HttpRequestFut::with_buf(r, req_remains).then(|res| { +fn handle_http_keepalive(r: BufReader>, svr_w: super::EncryptedHalf) -> BoxIoFuture<()> { + let fut = HttpRequestFut::new(r).then(|res| { match res { - Ok((r, req, remains)) => { + Ok((r, req)) => { let should_keep_alive = should_keep_alive(&req); trace!("Going to proxy request: {:?}", req); trace!("Should keep alive? {}", should_keep_alive); - let fut = proxy_request_encrypted((r, svr_w), None, req, remains) - .and_then(move |(r, svr_w, req_remains)| { - if should_keep_alive { - handle_http_keepalive(r, svr_w, req_remains) - } else { - futures::finished(()).boxed() - } - }); + let fut = proxy_request_encrypted((r, svr_w), None, req).and_then(move |(r, svr_w)| { + if should_keep_alive { + handle_http_keepalive(r, svr_w) + } else { + futures::finished(()).boxed() + } + }); Box::new(fut) as BoxIoFuture<()> } Err(err) => { @@ -521,11 +516,10 @@ fn handle_http_keepalive(r: ReadHalf, svr_w: super::EncryptedHalf, re } fn handle_http_proxy(handle: Handle, - (r, w): (ReadHalf, WriteHalf), + (r, w): (BufReader>, WriteHalf), client_addr: &SocketAddr, req: HttpRequest, addr: Address, - remains: Vec, svr_cfg: Rc) -> Box> { trace!("Using HTTP Proxy for {} -> {}", client_addr, addr); @@ -543,20 +537,22 @@ fn handle_http_proxy(handle: Handle, // Send the first request to server trace!("Going to proxy request: {:?}", req); trace!("Should keep alive? {}", should_keep_alive); - proxy_request_encrypted((r, svr_w), None, req, remains).and_then(move |(r, svr_w, req_remains)| { + + proxy_request_encrypted((r, svr_w), None, req).and_then(move |(r, svr_w)| { if should_keep_alive { - handle_http_keepalive(r, svr_w, req_remains) + handle_http_keepalive(r, svr_w) } else { futures::finished(()).boxed() } }) }); - rhalf.join(whalf) + let fut = rhalf.join(whalf) .then(move |_| { trace!("Relay to {} is finished", cloned_addr); Ok(()) - }) + }); + boxed_future(fut) }) }); @@ -570,7 +566,9 @@ fn handle_client(handle: &Handle, socket: TcpStream, _: SocketAddr, svr_cfg: Rc< .and_then(|(r, w)| { // Process the first request to see whether client wants CONNECT tunnel or normal HTTP proxy - HttpRequestFut::new(r).and_then(move |(r, mut req, remains)| { + let r = BufReader::new(r); + + HttpRequestFut::new(r).and_then(move |(r, mut req)| { trace!("Got HTTP Request, version: {}, method: {}, uri: {}", req.version, req.method, @@ -579,7 +577,7 @@ fn handle_client(handle: &Handle, socket: TcpStream, _: SocketAddr, svr_cfg: Rc< match req.get_address() { Ok(addr) => { req.clear_request_uri_host(); - boxed_future(futures::finished((r, w, req, addr, remains))) + boxed_future(futures::finished((r, w, req, addr))) } Err(status_code) => { error!("Invalid Uri: {}", req.request_uri); @@ -592,21 +590,15 @@ fn handle_client(handle: &Handle, socket: TcpStream, _: SocketAddr, svr_cfg: Rc< } }) }) - .and_then(move |(r, w, req, addr, remains)| { + .and_then(move |(r, w, req, addr)| { match req.method.clone() { Method::Connect => { info!("CONNECT (Http) {}", addr); - handle_connect(cloned_handle, (r, w), req, addr, remains, svr_cfg) + handle_connect(cloned_handle, (r, w), req, addr, svr_cfg) } met => { info!("{} (Http) {}", met, addr); - handle_http_proxy(cloned_handle, - (r, w), - &client_addr, - req, - addr, - remains, - svr_cfg) + handle_http_proxy(cloned_handle, (r, w), &client_addr, req, addr, svr_cfg) } } });