From 57289c1248d1fd2d6d5b235d623b6e8424ff3b7b Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Fri, 21 Sep 2018 13:25:49 +0100 Subject: [PATCH 1/8] Switch to use AWS signature v4 --- Cargo.lock | 566 ++++++++++++++++++++++------- Cargo.toml | 5 +- docker-compose.yml | 4 +- frontend.Dockerfile | 3 + src/bin/render-readmes.rs | 1 - src/config.rs | 62 ++-- src/git.rs | 12 +- src/lib.rs | 5 +- src/middleware/security_headers.rs | 4 +- src/s3/Cargo.toml | 19 - src/s3/lib.rs | 141 ------- src/uploaders.rs | 193 ++++++++-- src/util/errors.rs | 12 + 13 files changed, 642 insertions(+), 385 deletions(-) delete mode 100644 src/s3/Cargo.toml delete mode 100644 src/s3/lib.rs diff --git a/Cargo.lock b/Cargo.lock index b68b8d5f0f5..ed09336f57a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,3 @@ -[[package]] -name = "advapi32-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.5.3" @@ -150,7 +141,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -158,7 +149,6 @@ name = "cargo-registry" version = "0.2.2" dependencies = [ "ammonia 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-registry-s3 0.2.0", "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "civet 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "comrak 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -181,7 +171,7 @@ dependencies = [ "dotenv 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -195,6 +185,9 @@ dependencies = [ "oauth2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "rusoto_core 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusoto_credential 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusoto_s3 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)", "scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -207,16 +200,6 @@ dependencies = [ "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "cargo-registry-s3" -version = "0.2.0" -dependencies = [ - "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cc" version = "1.0.3" @@ -253,6 +236,14 @@ name = "civet-sys" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cmake" version = "0.1.26" @@ -394,6 +385,15 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "core-foundation" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "core-foundation-sys" version = "0.2.3" @@ -402,23 +402,31 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "core-foundation-sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" -version = "0.3.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -426,19 +434,16 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "crypt32-sys" -version = "0.2.0" +name = "crypto-mac" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -458,7 +463,7 @@ dependencies = [ "curl-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -471,7 +476,7 @@ dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -591,6 +596,15 @@ dependencies = [ "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dirs" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "docopt" version = "0.8.1" @@ -716,7 +730,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -737,6 +751,11 @@ dependencies = [ "backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "filetime" version = "0.1.14" @@ -834,7 +853,7 @@ dependencies = [ [[package]] name = "futures" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -842,7 +861,7 @@ name = "futures-cpupool" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -863,7 +882,7 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -875,13 +894,13 @@ dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -889,6 +908,15 @@ name = "hex" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "hmac" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hmac" version = "0.6.2" @@ -952,21 +980,21 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -975,13 +1003,25 @@ name = "hyper-tls" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hyper-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "idna" version = "0.1.4" @@ -999,7 +1039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "iovec" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1053,7 +1093,7 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "md-5 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1091,7 +1131,7 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1103,7 +1143,7 @@ dependencies = [ "cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1130,7 +1170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" -version = "0.4.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1174,6 +1214,11 @@ dependencies = [ "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "md5" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "memchr" version = "0.1.11" @@ -1245,17 +1290,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "miow" version = "0.2.1" @@ -1273,12 +1328,28 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "native-tls" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.12 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "net2" version = "0.2.32" @@ -1361,7 +1432,20 @@ dependencies = [ "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl" +version = "0.10.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1371,7 +1455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.31" +version = "0.9.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1523,6 +1607,23 @@ dependencies = [ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rayon" version = "0.7.1" @@ -1537,7 +1638,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1611,6 +1712,14 @@ dependencies = [ "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "remove_dir_all" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ring" version = "0.11.1" @@ -1628,6 +1737,55 @@ name = "route-recognizer" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rusoto_core" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rusoto_credential 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusoto_credential" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusoto_s3" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rusoto_core 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.5" @@ -1646,6 +1804,14 @@ dependencies = [ "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "safemem" version = "0.2.0" @@ -1653,16 +1819,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "schannel" -version = "0.1.8" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", - "secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1684,23 +1845,25 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "secur32-sys" -version = "0.2.0" +name = "security-framework" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "security-framework" -version = "0.1.16" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1712,6 +1875,15 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "security-framework-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver" version = "0.1.20" @@ -1725,6 +1897,14 @@ dependencies = [ "semver-parser 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver-parser" version = "0.6.2" @@ -1734,6 +1914,11 @@ dependencies = [ "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "1.0.19" @@ -1769,6 +1954,17 @@ dependencies = [ "serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "siphasher" version = "0.2.2" @@ -1776,7 +1972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "slab" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1896,6 +2092,19 @@ dependencies = [ "rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tempfile" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tendril" version = "0.4.0" @@ -1963,19 +2172,32 @@ dependencies = [ [[package]] name = "tokio" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-fs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1984,16 +2206,25 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2001,27 +2232,27 @@ name = "tokio-executor" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-fs" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-io" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2029,12 +2260,12 @@ name = "tokio-reactor" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2042,7 +2273,7 @@ name = "tokio-service" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2051,32 +2282,35 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-threadpool" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-timer" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2085,10 +2319,10 @@ name = "tokio-tls" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2097,10 +2331,26 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2254,8 +2504,8 @@ name = "want" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2321,8 +2571,15 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "xml-rs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] -"checksum advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a" "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" "checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699" "checksum ammonia 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc0ea12b4977283c563e78eaf227b024d89d72a6394040fad4063899bfcfb48" @@ -2347,6 +2604,7 @@ dependencies = [ "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" "checksum civet 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6263e7af767a5bf9e4d3d0a6c3ceb5f3940ec85cf2fbfee59024b8a264be180f" "checksum civet-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "958d15372bf28b7983cb35e1d4bf36dd843b0d42e507c1c73aad7150372c5936" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "357c07e7a1fc95732793c1edb5901e1a1f305cfcf63a90eb12dbd22bdb6b789d" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum comrak 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c1e2cc9384b402a97e0f2b3f8bc1ef45425fe810e030a189f05ed701f4b5b1" @@ -2362,11 +2620,13 @@ dependencies = [ "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum cookie 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "477eb650753e319be2ae77ec368a58c638f9f0c4d941c39bad95e950fb1d1d0d" "checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67" +"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d" -"checksum crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe8153ef04a7594ded05b427ffad46ddeaf22e63fd48d42b3e1e3bb4db07cae7" -"checksum crossbeam-epoch 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b4e2817eb773f770dcb294127c011e22771899c21d18fce7dd739c0b9832e81" -"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b" -"checksum crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e34988f7e069e0b2f3bfc064295161e489b2d4e04a2e4248fb94360cdf00b4ec" +"checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" +"checksum crossbeam-deque 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3486aefc4c0487b9cb52372c97df0a48b8c249514af1ee99703bf70d2f2ceda1" +"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" +"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" +"checksum crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0999b4ff4d3446d4ddb19a63e9e00c1876e75cd7000d20e57a693b4b3f08d958" "checksum crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" "checksum curl 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7034c534a1d7d22f7971d6088aa9d281d219ef724026c3428092500f41ae9c2c" "checksum curl-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "4bee31aa3a079d5f3ff9579ea4dcfb1b1a17a40886f5f467436d383e78134b55" @@ -2382,6 +2642,7 @@ dependencies = [ "checksum diesel_ltree 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a5be92b29f9c84222bc20759c0f45e3a0cfb390da8ce98a10a1414894eceafea" "checksum diesel_migrations 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b42c35d1ce9e8d57a3e7001b4127f2bc1b073a89708bb7019f5be27c991c28" "checksum digest 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b29c278aa8fd30796bd977169e8004b4aa88cdcd2f32a6eb22bc2d5d38df94a" +"checksum dirs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f679c09c1cf5428702cc10f6846c56e4e23420d3a88bcc9335b17c630a7b710b" "checksum docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b5b93718f8b3e5544fcc914c43de828ca6c6ace23e0332c6080a2977b49787a" "checksum dotenv 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d6f0e2bb24d163428d8031d3ebd2d2bd903ad933205a97d0f18c7c1aade380f3" "checksum dotenv 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70de3c590ce18df70743cace1cf12565637a0b26fd8b04ef10c7d33fdc66cdc" @@ -2399,6 +2660,7 @@ dependencies = [ "checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a" "checksum error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum filetime 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "aa75ec8f7927063335a9583e7fa87b0110bb888cf766dc01b54c0ff70d760c8e" "checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f" "checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423" @@ -2411,12 +2673,13 @@ dependencies = [ "checksum fuchsia-zircon-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43f3795b4bae048dc6123a6b972cadde2e676f9ded08aef6bb77f5f157684a82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "51f93f3de6ba1794dcd5810b3546d004600a59a98266487c8407bc4b24e398f3" -"checksum futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "1a70b146671de62ec8c8ed572219ca5d594d9b06c0b364d5e67b722fc559b48c" +"checksum futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "0c84b40c7e2de99ffd70602db314a7a8c26b2b3d830e6f7f7a142a8860ab3ca4" "checksum futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e86f49cc0d92fe1b97a5980ec32d56208272cbb00f15044ea9e2799dde766fdf" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0c1c0203d653f4140241da0c1375a404f0a397249ec818cd2076c6280c50f6fa" "checksum h2 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c91a0ee01fcf961ae004d88f1a77fc47dc5db6164f7d57605cc9f2c93d535686" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum hmac 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44f3bdb08579d99d7dc761c0e266f13b5f2ab8c8c703b9fc9ef333cd8f48f55e" "checksum hmac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "efb895368093a17d136b1d9eecdb607c7aa038a452e646c74e37ded2da106285" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" "checksum html5ever 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba3a1fd1857a714d410c191364c5d7bf8a6487c0ab5575146d37dd7eb17ef523" @@ -2426,9 +2689,10 @@ dependencies = [ "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" "checksum hyper 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6416251e6672bff06fe96a3337570772845a44500fba2d178e2e55e0fab58a86" "checksum hyper-tls 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b220edc52ee36375afea455c0ad46ac3a76c1a9ad2ed117eaafb60e93a4a3c1e" +"checksum hyper-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caaee4dea92794a9e697038bd401e264307d1f22c883dbcb6f6618ba0d3b3bd3" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220" -"checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21" "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -2443,12 +2707,13 @@ dependencies = [ "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" "checksum license-exprs 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e66da8cfc5d7882ef44dfae506db874873bb7596bc89468c30afbdb47e115593" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" -"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" +"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum maplit 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ed95049d40b8a1a7691adbabca028ad481f7e6a2921ce4846e1ee168b4e4ca5" "checksum markup5ever 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2cf89d3e0486c32c9d99521455ddf9a438910a1ce2bd376936086edc15dff5fc" "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" "checksum md-5 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9402eaae33a9e144ce18ef488a0e4ca19869673c7bcdbbfe2030fdc3f84211cd" +"checksum md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "79c56d6a0b07f9e19282511c83fc5b086364cbae4ba8c7d5f190c3d9b0425a48" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a" "checksum memchr 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e01e64d9017d18e7fc09d8e4fe0e28ff6931019e979fb8019319db7ca827f8a6" @@ -2458,8 +2723,10 @@ dependencies = [ "checksum mime 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fe51c8699d2dc522bf8c1ebe26ea2193d151fb54bcdfd7d0318750c189994cd9" "checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" "checksum mio 0.6.14 (registry+https://github.com/rust-lang/crates.io-index)" = "6d771e3ef92d58a8da8df7d6976bfca9371ed1de6619d9d5a5ce5b1f29b85bfe" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04b781c9134a954c84f0594b9ab3f5606abc516030388e8511887ef4c204a1e5" +"checksum native-tls 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8b0a7bd714e83db15676d31caf968ad7318e9cc35f93c85a90231c8f22867549" "checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" @@ -2469,9 +2736,10 @@ dependencies = [ "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" "checksum num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "514f0d73e64be53ff320680ca671b64fe3fb91da01e1ae2ddc99eb51d453b20d" "checksum oauth2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4fcd990d45681b9eba5f4f3fa7d0371ec277f4e4380a94104d26aa4fae386fc" +"checksum openssl 0.10.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2e79eede055813a3ac52fb3915caf8e1c9da2dec1587871aec9f6f7b48508d" "checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" "checksum openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d98df0270d404ccd3c050a41d579c52d1db15375168bb3471e04ec0f5f378daf" -"checksum openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6a27d108b29befe1822d40e2e22f85518dac59acbf7f30fdc532f48fd0a77" +"checksum openssl-sys 0.9.36 (registry+https://github.com/rust-lang/crates.io-index)" = "409d77eeb492a1aebd6eb322b2ee72ff7c7496b4434d98b3bf8be038755de65e" "checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" "checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc" "checksum pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf" @@ -2491,6 +2759,8 @@ dependencies = [ "checksum r2d2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "59611202bee496c586ecd84e3ed149b4ec75981b0fc10d7f60e878fa23ae16e9" "checksum rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "6475140dfd8655aeb72e1fd4b7a1cc1c202be65d71669476e392fe62532b9edd" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "checksum rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c51c07654ddd93f6cb543c7a849863b03abc7e82591afda6dc8ad4ac3ac4a" "checksum rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7febc28567082c345f10cddc3612c6ea020fc3297a1977d472cf9fdb73e6e493" "checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509" @@ -2501,28 +2771,37 @@ dependencies = [ "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" "checksum regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05b06a75f5217880fc5e905952a42750bf44787e56a6c6d6852ed0992f5e1d54" +"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum ring 0.11.1 (git+https://github.com/SergioBenitez/ring?branch=v0.11)" = "" "checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256" +"checksum rusoto_core 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dac3a75644426c7d4116e85dd314d5be26400f06d40d5673511d69a1168101f6" +"checksum rusoto_credential 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6b31eb8789afa4e601fa4677cab6886cbf8830b765f4da5cff2ba24ab485bfe" +"checksum rusoto_s3 0.34.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3d30772fe4432d78bd100299b6063c2e74f89886f87a65518d2d66680bbcf0" "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" -"checksum schannel 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7554288337c1110e34d7a2433518d889374c1de1a45f856b7bcddb03702131fc" +"checksum schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "dc1fabf2a7b6483a141426e1afd09ad543520a77ac49bd03c286e7696ccfd77f" "checksum scheduled-thread-pool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a2ff3fc5223829be817806c6441279c676e454cc7da608faf03b0ccc09d3889" "checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f412dfa83308d893101dd59c10d6fda8283465976c28c287c5c855bf8d216bc" "checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332" +"checksum security-framework 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "697d3f3c23a618272ead9e1fb259c1411102b31c6af8b93f1d64cca9c3b0e8e0" "checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead" +"checksum security-framework-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab01dfbe5756785b5b4d46e0289e5a18071dfa9a7c2b24213ea00b9ef9b665bf" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fff3c9c5a54636ab95acd8c1349926e04cb1eb8cd70b5adced8a1d1f703a67" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "0c9cab69e16835717c9b8bd13c29f92b6aa34fe32ce2866b1ab481cf2da8442a" "checksum serde_derive 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3bdafe3e71710131a919735916caa5b18c2754ad0d33d8ae5d586ccc804a403e" "checksum serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab" "checksum serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1e67ce320daa7e494c578e34d4b00689f23bb94512fe0ca0dfaf02ea53fb67" +"checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" -"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" +"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" "checksum socket2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b4896961171cd3317c7e9603d88f379f8c6e45342212235d356496680c68fd" "checksum string 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31f98b200e7caca9efca50fc0aa69cd58a5ec81d5f6e75b2f3ecaad2e998972a" "checksum string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "413fc7852aeeb5472f1986ef755f561ddf0c789d3d796e65f0b6fe293ecd4ef8" @@ -2536,6 +2815,7 @@ dependencies = [ "checksum syntex_fmt_macros 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5386bdc48758d136af85b3880548e1f3a9fad8d7dc2b38bdb48c36a9cdefc0" "checksum tar 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "6af6b94659f9a571bf769a5b71f54079393585ee0bfdd71b691be22d7d6b1d18" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" +"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" "checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" @@ -2543,18 +2823,21 @@ dependencies = [ "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520" -"checksum tokio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d00555353b013e170ed8bc4e13f648a317d1fd12157dbcae13f7013f6cf29f5" +"checksum tokio 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fbb6a6e9db2702097bfdfddcb09841211ad423b86c75b5ddaca1d62842ac492c" +"checksum tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "881e9645b81c2ce95fcb799ded2c29ffb9f25ef5bef909089a420e5961dd8ccb" "checksum tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" +"checksum tokio-current-thread 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdfb899688ac16f618076bd09215edbfda0fd5dfecb375b6942636cb31fa8a7" "checksum tokio-executor 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8cac2a7883ff3567e9d66bb09100d09b33d90311feca0206c7ca034bc0c55113" -"checksum tokio-fs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76766830bbf9a2d5bfb50c95350d56a2e79e2c80f675967fff448bc615899708" -"checksum tokio-io 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af9eb326f64b2d6b68438e1953341e00ab3cf54de7e35d92bfc73af8555313a" +"checksum tokio-fs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5cbe4ca6e71cb0b62a66e4e6f53a8c06a6eefe46cc5f665ad6f274c9906f135" +"checksum tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6cc2de7725863c86ac71b0b9068476fec50834f055a243558ef1655bbd34cb" "checksum tokio-reactor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3cedc8e5af5131dc3423ffa4f877cce78ad25259a9a62de0613735a13ebc64b" "checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" "checksum tokio-tcp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec9b094851aadd2caf83ba3ad8e8c4ce65a42104f7b94d9e6550023f0407853f" -"checksum tokio-threadpool 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5783254b10c7c84a56f62c74766ef7e5b83d1f13053218c7cab8d3f2c826fa0e" -"checksum tokio-timer 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535fed0ccee189f3d48447587697ba3fd234b3dbbb091f0ec4613ddfec0a7c4c" +"checksum tokio-threadpool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a5758cecb6e0633cea5d563ac07c975e04961690b946b04fd84e7d6445a8f6af" +"checksum tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d03fa701f9578a01b7014f106b47f0a363b4727a7f3f75d666e312ab7acbbf1c" "checksum tokio-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772f4b04e560117fe3b0a53e490c16ddc8ba6ec437015d91fa385564996ed913" "checksum tokio-udp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "137bda266504893ac4774e0ec4c2108f7ccdbcb7ac8dced6305fe9e4e0b5041a" +"checksum tokio-uds 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "424c1ed15a0132251813ccea50640b224c809d6ceafb88154c1a8775873a0e89" "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum try-lock 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2aa4715743892880f70885373966c83d73ef1b0838a664ef0c76fffd35e7c2" "checksum twoway 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "316040e0ac00cf50ab656c9061ddcc20a57bb87ecb32a10c9a7cadd70d373871" @@ -2588,3 +2871,4 @@ dependencies = [ "checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "abb373b92de38a4301d66bec009929b4fb83120ea1c4a401be89dbe0b9777443" +"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" diff --git a/Cargo.toml b/Cargo.toml index ae9963413a6..dfc61392fbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ rustdoc-args = [ ] [dependencies] -cargo-registry-s3 = { path = "src/s3", version = "0.2.0" } rand = "0.3" git2 = "0.6.4" flate2 = "1.0" @@ -40,6 +39,7 @@ curl = "0.4" oauth2 = "0.3" log = "0.3" env_logger = "0.5" +futures = "0.1.24" hex = "0.3" htmlescape = "0.3.1" license-exprs = "^1.4" @@ -48,6 +48,9 @@ toml = "0.4" diesel = { version = "1.3.0", features = ["postgres", "serde_json", "chrono", "r2d2"] } diesel_full_text_search = "1.0.0" diesel_ltree = "0.1.3" +rusoto_core = "0.34.0" +rusoto_credential = "0.13.0" +rusoto_s3 = "0.34.0" serde_json = "1.0.0" serde_derive = "1.0.0" serde = "1.0.0" diff --git a/docker-compose.yml b/docker-compose.yml index e760c2335a9..d9174726754 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: volumes: # Mount the src/ directory so we don't have to rebuild the Docker image # when we want to change some code - - ./src:/app/src:ro + - ./src:/app/src - index:/app/tmp - cargo-cache:/usr/local/cargo/registry @@ -37,7 +37,7 @@ services: build: context: . dockerfile: frontend.Dockerfile - entrypoint: npm run start --proxy http://backend:8888 + entrypoint: npm run start -- --proxy http://backend:8888 links: - backend ports: diff --git a/frontend.Dockerfile b/frontend.Dockerfile index ad171411099..e6861c83b73 100644 --- a/frontend.Dockerfile +++ b/frontend.Dockerfile @@ -5,4 +5,7 @@ COPY package.json /app COPY . /app +RUN npm install -g ember-cli +RUN npm install + ENTRYPOINT ["npm", "run", "start:staging"] diff --git a/src/bin/render-readmes.rs b/src/bin/render-readmes.rs index e485356a750..09e1ba0e486 100644 --- a/src/bin/render-readmes.rs +++ b/src/bin/render-readmes.rs @@ -150,7 +150,6 @@ fn main() { config .uploader .upload( - Easy::new(), &readme_path, readme.as_bytes(), "text/html", diff --git a/src/config.rs b/src/config.rs index 03561ba1113..516c390e039 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,3 @@ -use s3; - use std::env; use std::path::PathBuf; @@ -38,6 +36,7 @@ impl Default for Config { /// - `S3_REGION`: The region in which the bucket was created. Optional if US standard. /// - `S3_ACCESS_KEY`: The access key to interact with S3. Optional if running a mirror. /// - `S3_SECRET_KEY`: The secret key to interact with S3. Optional if running a mirror. + /// - `S3_HOST`: The S3 host to use. Optional. /// - `SESSION_KEY`: The key used to sign and encrypt session cookies. /// - `GH_CLIENT_ID`: The client ID of the associated GitHub application. /// - `GH_CLIENT_SECRET`: The client secret of the associated GitHub application. @@ -56,22 +55,20 @@ impl Default for Config { } else { Env::Development }; + let uploader = match (cargo_env, mirror) { (Env::Production, Replica::Primary) => { // `env` panics if these vars are not set, and in production for a primary instance, // that's what we want since we don't want to be able to start the server if the // server doesn't know where to upload crates. - Uploader::S3 { - bucket: s3::Bucket::new( - env("S3_BUCKET"), - env::var("S3_REGION").ok(), - env("S3_ACCESS_KEY"), - env("S3_SECRET_KEY"), - &api_protocol, - ), - cdn: env::var("S3_CDN").ok(), - proxy: None, - } + Uploader::new_s3( + env("S3_BUCKET"), + env::var("S3_REGION").ok(), + env("S3_ACCESS_KEY"), + env("S3_SECRET_KEY"), + env::var("S3_HOST").ok(), + env::var("S3_CDN").ok(), + ) } (Env::Production, Replica::ReadOnlyMirror) => { // Read-only mirrors don't need access key or secret key since by definition, @@ -82,17 +79,14 @@ impl Default for Config { // // Read-only mirrors definitely need bucket though, so that they know where // to serve crate files from. - Uploader::S3 { - bucket: s3::Bucket::new( - env("S3_BUCKET"), - env::var("S3_REGION").ok(), - env::var("S3_ACCESS_KEY").unwrap_or_default(), - env::var("S3_SECRET_KEY").unwrap_or_default(), - &api_protocol, - ), - cdn: env::var("S3_CDN").ok(), - proxy: None, - } + Uploader::new_s3( + env("S3_BUCKET"), + env::var("S3_REGION").ok(), + env::var("S3_ACCESS_KEY").unwrap_or_default(), + env::var("S3_SECRET_KEY").unwrap_or_default(), + env::var("S3_HOST").ok(), + env::var("S3_CDN").ok(), + ) } // In Development mode, either running as a primary instance or a read-only mirror _ => { @@ -102,17 +96,15 @@ impl Default for Config { // and read from S3 like production does. All values except for bucket are // optional, like production read-only mirrors. println!("Using S3 uploader"); - Uploader::S3 { - bucket: s3::Bucket::new( - env("S3_BUCKET"), - env::var("S3_REGION").ok(), - env::var("S3_ACCESS_KEY").unwrap_or_default(), - env::var("S3_SECRET_KEY").unwrap_or_default(), - &api_protocol, - ), - cdn: env::var("S3_CDN").ok(), - proxy: None, - } + + Uploader::new_s3( + env("S3_BUCKET"), + env::var("S3_REGION").ok(), + env::var("S3_ACCESS_KEY").unwrap_or_default(), + env::var("S3_SECRET_KEY").unwrap_or_default(), + env::var("S3_HOST").ok(), + env::var("S3_CDN").ok(), + ) } else { // If we don't set the `S3_BUCKET` variable, we'll use a development-only // uploader that makes it possible to run and publish to a locally-running diff --git a/src/git.rs b/src/git.rs index 238c1a5fb56..e500af4bb17 100644 --- a/src/git.rs +++ b/src/git.rs @@ -206,11 +206,19 @@ where pub fn credentials( _user: &str, - _user_from_url: Option<&str>, + user_from_url: Option<&str>, _cred: git2::CredentialType, ) -> Result { match (env::var("GIT_HTTP_USER"), env::var("GIT_HTTP_PWD")) { (Ok(u), Ok(p)) => git2::Cred::userpass_plaintext(&u, &p), - _ => Err(git2::Error::from_str("no authentication set")), + _ => { + // If there is no user, or password, try and use SSH keys using + // the SSH agent. + if let Some(user) = user_from_url { + git2::Cred::ssh_key_from_agent(user) + } else { + Err(git2::Error::from_str("no authentication set")) + } + } } } diff --git a/src/lib.rs b/src/lib.rs index 3f9b9a0331a..269f04afd75 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,7 @@ extern crate diesel_full_text_search; extern crate diesel_ltree; extern crate dotenv; extern crate flate2; +extern crate futures; extern crate git2; extern crate hex; extern crate htmlescape; @@ -32,7 +33,9 @@ extern crate log; extern crate oauth2; extern crate openssl; extern crate rand; -extern crate s3; +extern crate rusoto_core; +extern crate rusoto_credential; +extern crate rusoto_s3; extern crate scheduled_thread_pool; extern crate semver; extern crate serde; diff --git a/src/middleware/security_headers.rs b/src/middleware/security_headers.rs index bc3b4646ef6..52757b1a3d9 100644 --- a/src/middleware/security_headers.rs +++ b/src/middleware/security_headers.rs @@ -22,12 +22,12 @@ impl SecurityHeaders { let s3_host = match *uploader { Uploader::S3 { - ref bucket, + ref host, ref cdn, .. } => match *cdn { Some(ref s) => s.clone(), - None => bucket.host(), + None => host.clone(), }, _ => unreachable!( "This middleware should only be used in the production environment, \ diff --git a/src/s3/Cargo.toml b/src/s3/Cargo.toml deleted file mode 100644 index a2806be81d4..00000000000 --- a/src/s3/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] - -name = "cargo-registry-s3" -version = "0.2.0" -authors = ["Alex Crichton "] -license = "MIT OR Apache-2.0" -repository = "https://github.com/rust-lang/crates.io" -description = "Interaction between crates.io and S3 for storing crate files" - -[lib] - -name = "s3" -path = "lib.rs" - -[dependencies] -openssl = "0.9" -chrono = "0.4" -curl = "0.4" -base64 = "0.6" diff --git a/src/s3/lib.rs b/src/s3/lib.rs deleted file mode 100644 index aaf40b88d2d..00000000000 --- a/src/s3/lib.rs +++ /dev/null @@ -1,141 +0,0 @@ -#![deny(warnings)] - -extern crate base64; -extern crate chrono; -extern crate curl; -extern crate openssl; - -use std::io::prelude::*; - -use base64::encode; -use chrono::prelude::Utc; -use curl::easy::{Easy, List, ReadError, Transfer}; -use openssl::hash::MessageDigest; -use openssl::pkey::PKey; -use openssl::sign::Signer; - -#[derive(Clone, Debug)] -pub struct Bucket { - name: String, - region: Option, - access_key: String, - secret_key: String, - proto: String, -} - -impl Bucket { - pub fn new( - name: String, - region: Option, - access_key: String, - secret_key: String, - proto: &str, - ) -> Bucket { - Bucket { - name, - region, - access_key, - secret_key, - proto: proto.to_string(), - } - } - - pub fn put<'a, 'b>( - &self, - easy: &'a mut Easy, - path: &str, - mut content: &'b [u8], - content_type: &str, - content_length: u64, - ) -> Transfer<'a, 'b> { - let path = if path.starts_with('/') { - &path[1..] - } else { - path - }; - let host = self.host(); - let date = Utc::now().to_rfc2822().to_string(); - let auth = self.auth("PUT", &date, path, "", content_type); - let url = format!("{}://{}/{}", self.proto, host, path); - - let mut headers = List::new(); - headers.append(&format!("Host: {}", host)).unwrap(); - headers.append(&format!("Date: {}", date)).unwrap(); - headers.append(&format!("Authorization: {}", auth)).unwrap(); - headers - .append(&format!("Content-Type: {}", content_type)) - .unwrap(); - - // Disable the `Expect: 100-continue` header for now, this cause - // problems with the test harness currently and the purpose is - // not yet clear. Would probably be good to reenable at some point. - headers.append("Expect:").unwrap(); - - easy.url(&url).unwrap(); - easy.put(true).unwrap(); - easy.http_headers(headers).unwrap(); - easy.upload(true).unwrap(); - easy.in_filesize(content_length).unwrap(); - - let mut transfer = easy.transfer(); - transfer - .read_function(move |data| content.read(data).map_err(|_| ReadError::Abort)) - .unwrap(); - - transfer - } - - pub fn delete<'a, 'b>(&self, easy: &'a mut Easy, path: &str) -> Transfer<'a, 'b> { - let path = if path.starts_with('/') { - &path[1..] - } else { - path - }; - let host = self.host(); - let date = Utc::now().to_rfc2822().to_string(); - let auth = self.auth("DELETE", &date, path, "", ""); - let url = format!("{}://{}/{}", self.proto, host, path); - - let mut headers = List::new(); - headers.append(&format!("Host: {}", host)).unwrap(); - headers.append(&format!("Date: {}", date)).unwrap(); - headers.append(&format!("Authorization: {}", auth)).unwrap(); - - easy.custom_request("DELETE").unwrap(); - easy.url(&url).unwrap(); - easy.http_headers(headers).unwrap(); - - easy.transfer() - } - - pub fn host(&self) -> String { - format!( - "{}.s3{}.amazonaws.com", - self.name, - match self.region { - Some(ref r) if r != "" => format!("-{}", r), - Some(_) => String::new(), - None => String::new(), - } - ) - } - - fn auth(&self, verb: &str, date: &str, path: &str, md5: &str, content_type: &str) -> String { - let string = format!( - "{verb}\n{md5}\n{ty}\n{date}\n{headers}{resource}", - verb = verb, - md5 = md5, - ty = content_type, - date = date, - headers = "", - resource = format!("/{}/{}", self.name, path) - ); - let signature = { - let key = PKey::hmac(self.secret_key.as_bytes()).unwrap(); - let mut signer = Signer::new(MessageDigest::sha1(), &key).unwrap(); - signer.update(string.as_bytes()).unwrap(); - encode(&signer.sign_to_vec().unwrap()[..]) - }; - format!("AWS {}:{}", self.access_key, signature) - } -} diff --git a/src/uploaders.rs b/src/uploaders.rs index 7661bfdc438..2ee81e53814 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -1,8 +1,6 @@ use conduit::Request; -use curl::easy::Easy; use flate2::read::GzDecoder; use openssl::hash::{Hasher, MessageDigest}; -use s3; use semver; use tar; @@ -10,20 +8,32 @@ use util::LimitErrorReader; use util::{human, internal, CargoResult, ChainError, Maximums}; use std::env; +use std::fmt; use std::fs::{self, File}; use std::io::{Read, Write}; use std::sync::Arc; +use futures::future::{result, FutureResult}; +use futures::{Future, Poll}; + +use rusoto_core::{Region, ProvideAwsCredentials}; +use rusoto_core::request::HttpClient; +use rusoto_credential::{AwsCredentials, CredentialsError}; +use rusoto_s3::{DeleteObjectRequest, PutObjectRequest, S3, S3Client}; + use app::App; + use middleware::app::RequestApp; use models::Crate; -#[derive(Clone, Debug)] +#[derive(Clone)] pub enum Uploader { /// For production usage, uploads and redirects to s3. /// For test usage with a proxy. S3 { - bucket: s3::Bucket, + client: Arc, + bucket: String, + host: String, cdn: Option, proxy: Option, }, @@ -36,7 +46,61 @@ pub enum Uploader { NoOp, } +impl fmt::Debug for Uploader { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + Uploader::S3 { + .. + } => { + write!(f, "Uploader::S3") + } + Uploader::Local => write!(f, "Uploader::Local"), + Uploader::NoOp => write!(f, "Uploader::NoOp") + } + } +} + impl Uploader { + /// Creates a new S3 uploader object. + pub fn new_s3( + bucket: String, + region: Option, + access_key: String, + secret_key: String, + host: Option, + cdn: Option, + ) -> Uploader { + let host = host.unwrap_or(format!( + "{}.s3{}.amazonaws.com", + bucket, + match region { + Some(ref r) if r != "" => format!("-{}", r), + Some(_) => String::new(), + None => String::new(), + } + )); + + // Use the custom handler as we always provide an endpoint to connect to. + let region = Region::Custom { + name: region.unwrap_or("us-east-1".to_string()), + endpoint: host.clone(), + }; + + let dispatcher = HttpClient::new() + .expect("failed to create request dispatcher"); + let credentials = S3CredentialsProvider::new(access_key, secret_key); + + let s3client = S3Client::new_with(dispatcher, credentials, region); + + Uploader::S3 { + client: Arc::new(s3client), + bucket: bucket, + host: host, + cdn: cdn, + proxy: None, + } + } + pub fn proxy(&self) -> Option<&str> { match *self { Uploader::S3 { ref proxy, .. } => proxy.as_ref().map(String::as_str), @@ -51,16 +115,18 @@ impl Uploader { pub fn crate_location(&self, crate_name: &str, version: &str) -> Option { match *self { Uploader::S3 { + ref host, ref bucket, ref cdn, .. } => { let host = match *cdn { Some(ref s) => s.clone(), - None => bucket.host(), + None => host.clone(), }; + let path = Uploader::crate_path(crate_name, version); - Some(format!("https://{}/{}", host, path)) + Some(format!("https://{}/{}/{}", host, bucket, path)) } Uploader::Local => Some(format!("/{}", Uploader::crate_path(crate_name, version))), Uploader::NoOp => None, @@ -74,16 +140,17 @@ impl Uploader { pub fn readme_location(&self, crate_name: &str, version: &str) -> Option { match *self { Uploader::S3 { + ref host, ref bucket, ref cdn, .. } => { let host = match *cdn { Some(ref s) => s.clone(), - None => bucket.host(), + None => host.clone(), }; let path = Uploader::readme_path(crate_name, version); - Some(format!("https://{}/{}", host, path)) + Some(format!("https://{}/{}/{}", host, bucket, path)) } Uploader::Local => Some(format!("/{}", Uploader::readme_path(crate_name, version))), Uploader::NoOp => None, @@ -107,7 +174,6 @@ impl Uploader { /// and its checksum. pub fn upload( &self, - mut handle: Easy, path: &str, body: &[u8], content_type: &str, @@ -115,31 +181,25 @@ impl Uploader { ) -> CargoResult<(Option, Vec)> { let hash = hash(body); match *self { - Uploader::S3 { ref bucket, .. } => { - let (response, cksum) = { - let mut response = Vec::new(); - { - let mut s3req = - bucket.put(&mut handle, path, body, content_type, file_length); - s3req - .write_function(|data| { - response.extend(data); - Ok(data.len()) - }).unwrap(); - s3req.perform().chain_error(|| { - internal(&format_args!("failed to upload to S3: `{}`", path)) - })?; - } - (response, hash) + Uploader::S3 { + ref client, + ref bucket, + .. + } => { + let req = PutObjectRequest { + bucket: bucket.to_string(), + key: path.to_string(), + content_type: Some(content_type.to_string()), + content_length: Some(file_length as i64), + body: Some(body.to_vec().into()), + ..Default::default() }; - if handle.response_code().unwrap() != 200 { - let response = String::from_utf8_lossy(&response); - return Err(internal(&format_args!( - "failed to get a 200 response from S3: {}", - response - ))); - } - Ok((Some(String::from(path)), cksum)) + + client.put_object(req).sync().chain_error(|| { + internal(&format_args!("failed to upload to S3: `{}`", path)) + })?; + + Ok((Some(String::from(path)), hash)) } Uploader::Local => { let filename = env::current_dir().unwrap().join("local_uploads").join(path); @@ -171,7 +231,6 @@ impl Uploader { LimitErrorReader::new(req.body(), maximums.max_upload_size).read_to_end(&mut body)?; verify_tarball(krate, vers, &body, maximums.max_unpack_size)?; self.upload( - app.handle(), &path, &body, "application/x-tar", @@ -188,7 +247,6 @@ impl Uploader { let path = Uploader::readme_path(&krate.name, &vers.to_string()); let length = rendered.len(); self.upload( - app.handle(), &path, rendered.as_bytes(), "text/html", @@ -208,11 +266,23 @@ impl Uploader { } /// Deletes an uploaded file. - fn delete(&self, app: &Arc, path: &str) -> CargoResult<()> { + fn delete(&self, path: &str) -> CargoResult<()> { match *self { - Uploader::S3 { ref bucket, .. } => { - let mut handle = app.handle(); - bucket.delete(&mut handle, path).perform()?; + Uploader::S3 { + ref client, + ref bucket, + .. + } => { + let req = DeleteObjectRequest { + bucket: bucket.to_string(), + key: path.to_string(), + ..Default::default() + }; + + client.delete_object(req).sync().chain_error(|| { + internal(&format_args!("failed to upload to S3: `{}`", path)) + })?; + Ok(()) } Uploader::Local => { @@ -224,6 +294,49 @@ impl Uploader { } } +#[derive(Clone, Debug)] +pub struct S3CredentialsProvider { + access_key: String, + secret_key: String, +} + +impl S3CredentialsProvider { + fn new(access_key: String, secret_key: String) -> S3CredentialsProvider { + S3CredentialsProvider { + access_key: access_key, + secret_key: secret_key, + } + } +} + +/// Provides AWS credentials from an S3CredentialsProvider object as a Future. +#[derive(Debug)] +pub struct S3CredentialsProviderFuture { + inner: FutureResult, +} + +impl Future for S3CredentialsProviderFuture { + type Item = AwsCredentials; + type Error = CredentialsError; + + fn poll(&mut self) -> Poll { + self.inner.poll() + } +} + +impl ProvideAwsCredentials for S3CredentialsProvider { + type Future = S3CredentialsProviderFuture; + + fn credentials(&self) -> Self::Future { + let access_key = self.access_key.clone(); + let secret_key = self.secret_key.clone(); + + S3CredentialsProviderFuture { + inner: result(Ok(AwsCredentials::new(access_key, secret_key, None, None))) + } + } +} + // Can't derive Debug because of App. #[allow(missing_debug_implementations)] pub struct Bomb { @@ -234,7 +347,7 @@ pub struct Bomb { impl Drop for Bomb { fn drop(&mut self) { if let Some(ref path) = self.path { - if let Err(e) = self.app.config.uploader.delete(&self.app, path) { + if let Err(e) = self.app.config.uploader.delete(path) { println!("unable to delete {}, {:?}", path, e); } } diff --git a/src/util/errors.rs b/src/util/errors.rs index 2973a217368..da009d07f4e 100644 --- a/src/util/errors.rs +++ b/src/util/errors.rs @@ -199,6 +199,18 @@ impl CargoError for ::std::io::Error { } } +impl CargoError for ::rusoto_s3::PutObjectError { + fn description(&self) -> &str { + Error::description(self) + } +} + +impl CargoError for ::rusoto_s3::DeleteObjectError { + fn description(&self) -> &str { + Error::description(self) + } +} + // ============================================================================= // Concrete errors From a5e19a0be4128f3add08524d4a29a1275d677e6a Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Fri, 21 Sep 2018 15:26:50 +0100 Subject: [PATCH 2/8] Sorting out rustfmt errors --- src/middleware/security_headers.rs | 4 +-- src/uploaders.rs | 47 +++++++++++------------------- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/middleware/security_headers.rs b/src/middleware/security_headers.rs index 52757b1a3d9..0881c58c9f1 100644 --- a/src/middleware/security_headers.rs +++ b/src/middleware/security_headers.rs @@ -22,9 +22,7 @@ impl SecurityHeaders { let s3_host = match *uploader { Uploader::S3 { - ref host, - ref cdn, - .. + ref host, ref cdn, .. } => match *cdn { Some(ref s) => s.clone(), None => host.clone(), diff --git a/src/uploaders.rs b/src/uploaders.rs index 2ee81e53814..be12b1fc0b6 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -16,8 +16,8 @@ use std::sync::Arc; use futures::future::{result, FutureResult}; use futures::{Future, Poll}; -use rusoto_core::{Region, ProvideAwsCredentials}; use rusoto_core::request::HttpClient; +use rusoto_core::{ProvideAwsCredentials, Region}; use rusoto_credential::{AwsCredentials, CredentialsError}; use rusoto_s3::{DeleteObjectRequest, PutObjectRequest, S3, S3Client}; @@ -49,13 +49,9 @@ pub enum Uploader { impl fmt::Debug for Uploader { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Uploader::S3 { - .. - } => { - write!(f, "Uploader::S3") - } - Uploader::Local => write!(f, "Uploader::Local"), - Uploader::NoOp => write!(f, "Uploader::NoOp") + Uploader::S3 { .. } => write!(f, "Uploader::S3"), + Uploader::Local => write!(f, "Uploader::Local"), + Uploader::NoOp => write!(f, "Uploader::NoOp"), } } } @@ -86,8 +82,7 @@ impl Uploader { endpoint: host.clone(), }; - let dispatcher = HttpClient::new() - .expect("failed to create request dispatcher"); + let dispatcher = HttpClient::new().expect("failed to create request dispatcher"); let credentials = S3CredentialsProvider::new(access_key, secret_key); let s3client = S3Client::new_with(dispatcher, credentials, region); @@ -184,7 +179,7 @@ impl Uploader { Uploader::S3 { ref client, ref bucket, - .. + .. } => { let req = PutObjectRequest { bucket: bucket.to_string(), @@ -195,9 +190,10 @@ impl Uploader { ..Default::default() }; - client.put_object(req).sync().chain_error(|| { - internal(&format_args!("failed to upload to S3: `{}`", path)) - })?; + client + .put_object(req) + .sync() + .chain_error(|| internal(&format_args!("failed to upload to S3: `{}`", path)))?; Ok((Some(String::from(path)), hash)) } @@ -230,12 +226,7 @@ impl Uploader { let mut body = Vec::new(); LimitErrorReader::new(req.body(), maximums.max_upload_size).read_to_end(&mut body)?; verify_tarball(krate, vers, &body, maximums.max_unpack_size)?; - self.upload( - &path, - &body, - "application/x-tar", - u64::from(file_length), - )? + self.upload(&path, &body, "application/x-tar", u64::from(file_length))? }; // We create the bomb for the crate file before uploading the readme so that if the // readme upload fails, the uploaded crate file is automatically deleted. @@ -246,12 +237,7 @@ impl Uploader { let (readme_path, _) = if let Some(rendered) = readme { let path = Uploader::readme_path(&krate.name, &vers.to_string()); let length = rendered.len(); - self.upload( - &path, - rendered.as_bytes(), - "text/html", - length as u64, - )? + self.upload(&path, rendered.as_bytes(), "text/html", length as u64)? } else { (None, vec![]) }; @@ -279,9 +265,10 @@ impl Uploader { ..Default::default() }; - client.delete_object(req).sync().chain_error(|| { - internal(&format_args!("failed to upload to S3: `{}`", path)) - })?; + client + .delete_object(req) + .sync() + .chain_error(|| internal(&format_args!("failed to upload to S3: `{}`", path)))?; Ok(()) } @@ -332,7 +319,7 @@ impl ProvideAwsCredentials for S3CredentialsProvider { let secret_key = self.secret_key.clone(); S3CredentialsProviderFuture { - inner: result(Ok(AwsCredentials::new(access_key, secret_key, None, None))) + inner: result(Ok(AwsCredentials::new(access_key, secret_key, None, None))), } } } From 45842460756ed67aecb9a1dd896e2e97b5733a20 Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Thu, 11 Oct 2018 09:14:01 +0100 Subject: [PATCH 3/8] Sort out clippy errors --- src/bin/populate.rs | 3 ++- src/bin/render-readmes.rs | 12 ++++++++---- src/bin/update-downloads.rs | 23 +++++++++++++++-------- src/boot/categories.rs | 6 ++++-- src/controllers/crate_owner_invitation.rs | 3 ++- src/controllers/krate/downloads.rs | 3 ++- src/controllers/krate/follow.rs | 4 +--- src/controllers/krate/metadata.rs | 3 ++- src/controllers/krate/owners.rs | 3 +-- src/controllers/krate/publish.rs | 3 ++- src/controllers/krate/search.rs | 6 ++++-- src/controllers/token.rs | 3 +-- src/controllers/user/me.rs | 3 ++- src/controllers/user/other.rs | 3 ++- src/email.rs | 3 ++- src/git.rs | 3 ++- src/github.rs | 3 ++- src/models/badge.rs | 6 +----- src/models/category.rs | 21 ++++++++++++++------- src/models/dependency.rs | 3 ++- src/models/keyword.rs | 3 ++- src/models/krate.rs | 17 ++++++++++------- src/render.rs | 15 ++++++--------- src/router.rs | 2 +- src/tests/all.rs | 12 +++++++----- src/tests/krate.rs | 6 ++++-- src/tests/owners.rs | 9 ++++++--- src/tests/record.rs | 3 ++- src/uploaders.rs | 14 +++++++------- 29 files changed, 116 insertions(+), 82 deletions(-) diff --git a/src/bin/populate.rs b/src/bin/populate.rs index 06ca43e8ba6..b699d03083b 100644 --- a/src/bin/populate.rs +++ b/src/bin/populate.rs @@ -39,7 +39,8 @@ fn update(conn: &PgConnection) -> QueryResult<()> { version_downloads::version_id.eq(id), version_downloads::downloads.eq(dls), version_downloads::date.eq(date(now - day.days())), - )).execute(conn)?; + )) + .execute(conn)?; } } Ok(()) diff --git a/src/bin/render-readmes.rs b/src/bin/render-readmes.rs index 09e1ba0e486..71b4354b49b 100644 --- a/src/bin/render-readmes.rs +++ b/src/bin/render-readmes.rs @@ -84,7 +84,8 @@ fn main() { readme_renderings::rendered_at .lt(older_than) .or(readme_renderings::version_id.is_null()), - ).select(versions::id) + ) + .select(versions::id) .into_boxed(); if let Some(crate_name) = args.flag_crate { @@ -154,7 +155,8 @@ fn main() { readme.as_bytes(), "text/html", readme_len as u64, - ).unwrap_or_else(|_| { + ) + .unwrap_or_else(|_| { panic!( "[{}-{}] Couldn't upload file to S3", krate_name, version.num @@ -286,14 +288,16 @@ fn find_file_by_path( }; filepath == path } - }).unwrap_or_else(|| { + }) + .unwrap_or_else(|| { panic!( "[{}-{}] couldn't open file: {}", krate_name, version.num, path.display() ) - }).unwrap_or_else(|_| { + }) + .unwrap_or_else(|_| { panic!( "[{}-{}] file is not present: {}", krate_name, diff --git a/src/bin/update-downloads.rs b/src/bin/update-downloads.rs index 7b82a0b1efe..e9347fda241 100644 --- a/src/bin/update-downloads.rs +++ b/src/bin/update-downloads.rs @@ -92,7 +92,8 @@ fn collect(conn: &PgConnection, rows: &[VersionDownload]) -> QueryResult<()> { crate_downloads::crate_id.eq(crate_id), crate_downloads::downloads.eq(amt), crate_downloads::date.eq(download.date), - )).on_conflict(crate_downloads::table.primary_key()) + )) + .on_conflict(crate_downloads::table.primary_key()) .do_update() .set(crate_downloads::downloads.eq(crate_downloads::downloads + amt)) .execute(conn)?; @@ -137,7 +138,7 @@ mod test { name: "foo", ..Default::default() }.create_or_update(&conn, None, user_id) - .unwrap(); + .unwrap(); let version = NewVersion::new( krate.id, &semver::Version::parse("1.0.0").unwrap(), @@ -176,7 +177,8 @@ mod test { version_downloads::version_id.eq(version.id), version_downloads::date.eq(date(now - 1.day())), version_downloads::processed.eq(true), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); ::update(&conn).unwrap(); @@ -213,7 +215,8 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now - 2.days())), version_downloads::processed.eq(false), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); ::update(&conn).unwrap(); let processed = version_downloads::table @@ -236,7 +239,8 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now)), version_downloads::processed.eq(false), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); ::update(&conn).unwrap(); let processed = version_downloads::table @@ -269,13 +273,15 @@ mod test { version_downloads::counted.eq(1), version_downloads::date.eq(date(now)), version_downloads::processed.eq(false), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); insert_into(version_downloads::table) .values(( version_downloads::version_id.eq(version.id), version_downloads::date.eq(date(now - 1.day())), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); let version_before = versions::table @@ -331,7 +337,8 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now - 2.days())), version_downloads::processed.eq(false), - )).execute(&conn) + )) + .execute(&conn) .unwrap(); ::update(&conn).unwrap(); diff --git a/src/boot/categories.rs b/src/boot/categories.rs index 669367d4593..a64a506003f 100644 --- a/src/boot/categories.rs +++ b/src/boot/categories.rs @@ -107,7 +107,8 @@ pub fn sync_with_connection(toml_str: &str, conn: &PgConnection) -> CargoResult< category.eq(c.name), description.eq(c.description), ) - }).collect::>(); + }) + .collect::>(); conn.transaction(|| { let slugs = diesel::insert_into(categories) @@ -117,7 +118,8 @@ pub fn sync_with_connection(toml_str: &str, conn: &PgConnection) -> CargoResult< .set(( category.eq(excluded(category)), description.eq(excluded(description)), - )).returning(slug) + )) + .returning(slug) .get_results::(&*conn)?; diesel::delete(categories) diff --git a/src/controllers/crate_owner_invitation.rs b/src/controllers/crate_owner_invitation.rs index 032475a6b06..26fc8ed1d0f 100644 --- a/src/controllers/crate_owner_invitation.rs +++ b/src/controllers/crate_owner_invitation.rs @@ -71,7 +71,8 @@ fn accept_invite( owner_id: user_id, created_by: pending_crate_owner.invited_by_user_id, owner_kind: OwnerKind::User as i32, - }).on_conflict(crate_owners::table.primary_key()) + }) + .on_conflict(crate_owners::table.primary_key()) .do_update() .set(crate_owners::deleted.eq(false)) .execute(conn)?; diff --git a/src/controllers/krate/downloads.rs b/src/controllers/krate/downloads.rs index 15801c29ba0..1af10e71b50 100644 --- a/src/controllers/krate/downloads.rs +++ b/src/controllers/krate/downloads.rs @@ -39,7 +39,8 @@ pub fn downloads(req: &mut dyn Request) -> CargoResult { .select(( to_char(version_downloads::date, "YYYY-MM-DD"), sum_downloads, - )).filter(version_downloads::date.gt(date(now - 90.days()))) + )) + .filter(version_downloads::date.gt(date(now - 90.days()))) .group_by(version_downloads::date) .order(version_downloads::date.asc()) .load::(&*conn)?; diff --git a/src/controllers/krate/follow.rs b/src/controllers/krate/follow.rs index 86fe8c3a676..030873e25b0 100644 --- a/src/controllers/krate/follow.rs +++ b/src/controllers/krate/follow.rs @@ -11,9 +11,7 @@ fn follow_target(req: &mut dyn Request) -> CargoResult { let user = req.user()?; let conn = req.db_conn()?; let crate_name = &req.params()["crate_id"]; - let crate_id = Crate::by_name(crate_name) - .select(crates::id) - .first(&*conn)?; + let crate_id = Crate::by_name(crate_name).select(crates::id).first(&*conn)?; Ok(Follow { user_id: user.id, crate_id, diff --git a/src/controllers/krate/metadata.rs b/src/controllers/krate/metadata.rs index abef8f9a66e..723456d58e3 100644 --- a/src/controllers/krate/metadata.rs +++ b/src/controllers/krate/metadata.rs @@ -34,7 +34,8 @@ pub fn summary(req: &mut dyn Request) -> CargoResult { .zip(krates) .map(|(max_version, krate)| { Ok(krate.minimal_encodable(&max_version, None, false, None)) - }).collect() + }) + .collect() }; let new_crates = crates diff --git a/src/controllers/krate/owners.rs b/src/controllers/krate/owners.rs index 01d9d773d41..eb9e9a2cedb 100644 --- a/src/controllers/krate/owners.rs +++ b/src/controllers/krate/owners.rs @@ -95,8 +95,7 @@ fn modify_owners(req: &mut dyn Request, add: bool) -> CargoResult { owners: Option>, } - let request: Request = - serde_json::from_str(&body).map_err(|_| human("invalid json request"))?; + let request: Request = serde_json::from_str(&body).map_err(|_| human("invalid json request"))?; let logins = request .owners diff --git a/src/controllers/krate/publish.rs b/src/controllers/krate/publish.rs index 1cc1f327266..70058553489 100644 --- a/src/controllers/krate/publish.rs +++ b/src/controllers/krate/publish.rs @@ -53,7 +53,8 @@ pub fn publish(req: &mut dyn Request) -> CargoResult { k[..].to_string(), v.iter().map(|v| v[..].to_string()).collect(), ) - }).collect::>>(); + }) + .collect::>>(); let keywords = new_crate .keywords .as_ref() diff --git a/src/controllers/krate/search.rs b/src/controllers/krate/search.rs index 941d34cb86a..1f966969644 100644 --- a/src/controllers/krate/search.rs +++ b/src/controllers/krate/search.rs @@ -48,7 +48,8 @@ pub fn search(req: &mut dyn Request) -> CargoResult { ALL_COLUMNS, false.into_sql::(), recent_crate_downloads::downloads.nullable(), - )).into_boxed(); + )) + .into_boxed(); if let Some(q_string) = params.get("q") { if !q_string.is_empty() { @@ -189,7 +190,8 @@ pub fn search(req: &mut dyn Request) -> CargoResult { Some(recent_downloads), ) }, - ).collect(); + ) + .collect(); #[derive(Serialize)] struct R { diff --git a/src/controllers/token.rs b/src/controllers/token.rs index b9e62770d77..f8884f97742 100644 --- a/src/controllers/token.rs +++ b/src/controllers/token.rs @@ -53,8 +53,7 @@ pub fn new(req: &mut dyn Request) -> CargoResult { let mut json = vec![0; length as usize]; read_fill(req.body(), &mut json)?; - let json = - String::from_utf8(json).map_err(|_| bad_request(&"json body was not valid utf-8"))?; + let json = String::from_utf8(json).map_err(|_| bad_request(&"json body was not valid utf-8"))?; let new: NewApiTokenRequest = json::from_str(&json) .map_err(|e| bad_request(&format!("invalid new token request: {:?}", e)))?; diff --git a/src/controllers/user/me.rs b/src/controllers/user/me.rs index e10435e2df8..5b1d551e13c 100644 --- a/src/controllers/user/me.rs +++ b/src/controllers/user/me.rs @@ -34,7 +34,8 @@ pub fn me(req: &mut dyn Request) -> CargoResult { emails::verified.nullable(), emails::email.nullable(), emails::token_generated_at.nullable().is_not_null(), - )).first::<(User, Option, Option, bool)>(&*conn)?; + )) + .first::<(User, Option, Option, bool)>(&*conn)?; let verified = verified.unwrap_or(false); let verification_sent = verified || verification_sent; diff --git a/src/controllers/user/other.rs b/src/controllers/user/other.rs index ce41c527ffb..9823a3eeef4 100644 --- a/src/controllers/user/other.rs +++ b/src/controllers/user/other.rs @@ -37,7 +37,8 @@ pub fn stats(req: &mut dyn Request) -> CargoResult { crate_owners::owner_id .eq(user_id) .and(crate_owners::owner_kind.eq(OwnerKind::User as i32)), - ).select(sum(crates::downloads)) + ) + .select(sum(crates::downloads)) .first::>(&*conn)? .unwrap_or(0); diff --git a/src/email.rs b/src/email.rs index 5378c49ba91..6f496c69294 100644 --- a/src/email.rs +++ b/src/email.rs @@ -82,7 +82,8 @@ fn send_email(recipient: &str, subject: &str, body: &str) -> CargoResult<()> { .credentials(Credentials::new( mailgun_config.smtp_login, mailgun_config.smtp_password, - )).smtp_utf8(true) + )) + .smtp_utf8(true) .authentication_mechanism(Mechanism::Plain) .build(); diff --git a/src/git.rs b/src/git.rs index e500af4bb17..bc285065f4d 100644 --- a/src/git.rs +++ b/src/git.rs @@ -99,7 +99,8 @@ pub fn yank(app: &App, krate: &str, version: &semver::Version, yanked: bool) -> } git_crate.yanked = Some(yanked); Ok(serde_json::to_string(&git_crate).unwrap()) - }).collect::>>(); + }) + .collect::>>(); let new = new?.join("\n"); let mut f = File::create(&dst)?; f.write_all(new.as_bytes())?; diff --git a/src/github.rs b/src/github.rs index 749eeb67faf..d5226fe9b62 100644 --- a/src/github.rs +++ b/src/github.rs @@ -41,7 +41,8 @@ pub fn github(app: &App, url: &str, auth: &Token) -> Result<(Easy, Vec), cur .write_function(|buf| { data.extend_from_slice(buf); Ok(buf.len()) - }).unwrap(); + }) + .unwrap(); transfer.perform()?; } Ok((handle, data)) diff --git a/src/models/badge.rs b/src/models/badge.rs index d622f0fc091..9993c9f973a 100644 --- a/src/models/badge.rs +++ b/src/models/badge.rs @@ -22,11 +22,7 @@ pub struct CrateBadge { } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde( - rename_all = "kebab-case", - tag = "badge_type", - content = "attributes" -)] +#[serde(rename_all = "kebab-case", tag = "badge_type", content = "attributes")] pub enum Badge { TravisCi { repository: String, diff --git a/src/models/category.rs b/src/models/category.rs index 229d054219a..b9b0773ba38 100644 --- a/src/models/category.rs +++ b/src/models/category.rs @@ -118,7 +118,8 @@ impl Category { .map(|c| CrateCategory { category_id: c.id, crate_id: krate.id, - }).collect::>(); + }) + .collect::>(); delete(CrateCategory::belonging_to(krate)).execute(conn)?; insert_into(crates_categories::table) @@ -231,7 +232,8 @@ mod tests { (category.eq("Cat 2"), slug.eq("cat2")), (category.eq("Cat 1"), slug.eq("cat1")), (category.eq("Cat 1::sub"), slug.eq("cat1::sub")), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "", 10, 0) @@ -252,7 +254,8 @@ mod tests { (category.eq("Cat 1"), slug.eq("cat1"), crates_cnt.eq(0)), (category.eq("Cat 2"), slug.eq("cat2"), crates_cnt.eq(2)), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(1)), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 10, 0) @@ -276,7 +279,8 @@ mod tests { .values(&vec![ (category.eq("Cat 1"), slug.eq("cat1")), (category.eq("Cat 2"), slug.eq("cat2")), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "", 1, 0) @@ -320,7 +324,8 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(6)), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 10, 0) @@ -360,7 +365,8 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(6)), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 2, 0) @@ -414,7 +420,8 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(200)), - ]).execute(&conn) + ]) + .execute(&conn) .unwrap(); let cat = Category::by_slug("cat1::sub1") diff --git a/src/models/dependency.rs b/src/models/dependency.rs index 99854e380d3..05defc00ae6 100644 --- a/src/models/dependency.rs +++ b/src/models/dependency.rs @@ -128,7 +128,8 @@ pub fn add_dependencies( target.eq(dep.target.as_ref().map(|s| &**s)), ), )) - }).collect::, _>>()?; + }) + .collect::, _>>()?; let (git_deps, new_dependencies): (Vec<_>, Vec<_>) = git_and_new_dependencies.into_iter().unzip(); diff --git a/src/models/keyword.rs b/src/models/keyword.rs index d0ca48c4e18..807cc1df18b 100644 --- a/src/models/keyword.rs +++ b/src/models/keyword.rs @@ -85,7 +85,8 @@ impl Keyword { .map(|kw| CrateKeyword { crate_id: krate.id, keyword_id: kw.id, - }).collect::>(); + }) + .collect::>(); diesel::insert_into(crates_keywords::table) .values(&crate_keywords) .execute(conn)?; diff --git a/src/models/krate.rs b/src/models/krate.rs index 6c2bd2a5f50..6085bb59436 100644 --- a/src/models/krate.rs +++ b/src/models/krate.rs @@ -254,11 +254,12 @@ impl Crate { } fn valid_ident(name: &str) -> bool { - Self::valid_feature_name(name) && name - .chars() - .nth(0) - .map(char::is_alphabetic) - .unwrap_or(false) + Self::valid_feature_name(name) + && name + .chars() + .nth(0) + .map(char::is_alphabetic) + .unwrap_or(false) } pub fn valid_feature_name(name: &str) -> bool { @@ -439,7 +440,8 @@ impl Crate { invited_user_id: owner.id(), invited_by_user_id: req_user.id, crate_id: self.id, - }).on_conflict_do_nothing() + }) + .on_conflict_do_nothing() .execute(conn)?; Ok(format!( "user {} has been invited to be an owner of crate {}", @@ -455,7 +457,8 @@ impl Crate { owner_id: owner.id(), created_by: req_user.id, owner_kind: OwnerKind::Team as i32, - }).on_conflict(crate_owners::table.primary_key()) + }) + .on_conflict(crate_owners::table.primary_key()) .do_update() .set(crate_owners::deleted.eq(false)) .execute(conn)?; diff --git a/src/render.rs b/src/render.rs index 8580265d25d..2a0134e6ba3 100644 --- a/src/render.rs +++ b/src/render.rs @@ -56,8 +56,7 @@ impl<'a> MarkdownRenderer<'a> { "ul", "hr", "span", - ] - .iter() + ].iter() .cloned() .collect(); let tag_attributes = [ @@ -73,8 +72,7 @@ impl<'a> MarkdownRenderer<'a> { "input", ["checked", "disabled", "type"].iter().cloned().collect(), ), - ] - .iter() + ].iter() .cloned() .collect(); let allowed_classes = [( @@ -94,12 +92,10 @@ impl<'a> MarkdownRenderer<'a> { "language-scss", "language-sql", "yaml", - ] - .iter() + ].iter() .cloned() .collect(), - )] - .iter() + )].iter() .cloned() .collect(); @@ -182,7 +178,8 @@ impl<'a> MarkdownRenderer<'a> { UrlRelative::Custom(Box::new(relative_url_sanitizer)) } else { UrlRelative::Custom(Box::new(unrelative_url_sanitizer)) - }).id_prefix(Some("user-content-")); + }) + .id_prefix(Some("user-content-")); MarkdownRenderer { html_sanitizer } } diff --git a/src/router.rs b/src/router.rs index c44d8837ea4..c287f8dafc3 100644 --- a/src/router.rs +++ b/src/router.rs @@ -220,7 +220,7 @@ mod tests { 0, 0 ))).call(&mut req) - .is_err() + .is_err() ); assert!( C(|_| err(::std::io::Error::new(::std::io::ErrorKind::Other, ""))) diff --git a/src/tests/all.rs b/src/tests/all.rs index 77517b6c24b..66d8e1dd703 100644 --- a/src/tests/all.rs +++ b/src/tests/all.rs @@ -350,7 +350,8 @@ impl<'a> VersionBuilder<'a> { dependencies::default_features.eq(false), dependencies::features.eq(Vec::::new()), ) - }).collect::>(); + }) + .collect::>(); insert_into(dependencies::table) .values(&new_deps) .execute(connection)?; @@ -570,7 +571,8 @@ fn new_dependency(conn: &PgConnection, version: &Version, krate: &Crate) -> Depe optional.eq(false), default_features.eq(false), features.eq(Vec::::new()), - )).get_result(conn) + )) + .get_result(conn) .unwrap() } @@ -742,7 +744,8 @@ fn new_crate_to_body(new_crate: &u::NewCrate, files: &[(&str, &[u8])]) -> Vec>(); + }) + .collect::>(); new_crate_to_body_with_io(new_crate, &mut files) } @@ -774,8 +777,7 @@ fn new_crate_to_body_with_tarball(new_crate: &u::NewCrate, tarball: &[u8]) -> Ve (json.len() >> 8) as u8, (json.len() >> 16) as u8, (json.len() >> 24) as u8, - ] - .iter() + ].iter() .cloned(), ); body.extend(json.as_bytes().iter().cloned()); diff --git a/src/tests/krate.rs b/src/tests/krate.rs index 0237ec8eafa..4360b8d02db 100644 --- a/src/tests/krate.rs +++ b/src/tests/krate.rs @@ -1099,7 +1099,8 @@ fn new_krate_git_upload_appends() { .write_all( br#"{"name":"FPP","vers":"0.0.1","deps":[],"features":{},"cksum":"3j3"} "#, - ).unwrap(); + ) + .unwrap(); let mut req = new_req(Arc::clone(&app), "FPP", "1.0.0"); sign_in(&mut req, &app); @@ -1985,7 +1986,8 @@ fn reverse_dependencies() { VersionBuilder::new("1.1.0") .dependency(&c1, None) .dependency(&c1, Some("foo")), - ).expect_build(&conn); + ) + .expect_build(&conn); } let mut response = ok_resp!(middle.call(&mut req)); diff --git a/src/tests/owners.rs b/src/tests/owners.rs index cd7d74baabc..411fafacc5d 100644 --- a/src/tests/owners.rs +++ b/src/tests/owners.rs @@ -371,7 +371,8 @@ fn invitations_list() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }).execute(&*conn) + }) + .execute(&*conn) .unwrap(); (krate, user) }; @@ -431,7 +432,8 @@ fn test_accept_invitation() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }).execute(&*conn) + }) + .execute(&*conn) .unwrap(); (krate, user) }; @@ -525,7 +527,8 @@ fn test_decline_invitation() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }).execute(&*conn) + }) + .execute(&*conn) .unwrap(); (krate, user) }; diff --git a/src/tests/record.rs b/src/tests/record.rs index d2769269794..69c805c602d 100644 --- a/src/tests/record.rs +++ b/src/tests/record.rs @@ -122,7 +122,8 @@ pub fn proxy() -> (String, Bomb) { sink: sink2, record: Arc::clone(&record), client, - }).map_err(|e| eprintln!("server connection error: {}", e)); + }) + .map_err(|e| eprintln!("server connection error: {}", e)); drop(core.run(srv.select2(quitrx))); diff --git a/src/uploaders.rs b/src/uploaders.rs index be12b1fc0b6..4df560b8714 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -66,7 +66,7 @@ impl Uploader { host: Option, cdn: Option, ) -> Uploader { - let host = host.unwrap_or(format!( + let host = host.unwrap_or_else(|| format!( "{}.s3{}.amazonaws.com", bucket, match region { @@ -78,7 +78,7 @@ impl Uploader { // Use the custom handler as we always provide an endpoint to connect to. let region = Region::Custom { - name: region.unwrap_or("us-east-1".to_string()), + name: region.unwrap_or_else(|| "us-east-1".to_string()), endpoint: host.clone(), }; @@ -89,9 +89,9 @@ impl Uploader { Uploader::S3 { client: Arc::new(s3client), - bucket: bucket, - host: host, - cdn: cdn, + bucket, + host, + cdn, proxy: None, } } @@ -290,8 +290,8 @@ pub struct S3CredentialsProvider { impl S3CredentialsProvider { fn new(access_key: String, secret_key: String) -> S3CredentialsProvider { S3CredentialsProvider { - access_key: access_key, - secret_key: secret_key, + access_key, + secret_key, } } } From eedb5e1f228d52f895b3646b1befbd194533b8db Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Thu, 11 Oct 2018 09:17:04 +0100 Subject: [PATCH 4/8] Sort out rustfmt --- src/uploaders.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/uploaders.rs b/src/uploaders.rs index 4df560b8714..5b80aae099a 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -19,7 +19,7 @@ use futures::{Future, Poll}; use rusoto_core::request::HttpClient; use rusoto_core::{ProvideAwsCredentials, Region}; use rusoto_credential::{AwsCredentials, CredentialsError}; -use rusoto_s3::{DeleteObjectRequest, PutObjectRequest, S3, S3Client}; +use rusoto_s3::{DeleteObjectRequest, PutObjectRequest, S3Client, S3}; use app::App; @@ -66,15 +66,17 @@ impl Uploader { host: Option, cdn: Option, ) -> Uploader { - let host = host.unwrap_or_else(|| format!( - "{}.s3{}.amazonaws.com", - bucket, - match region { - Some(ref r) if r != "" => format!("-{}", r), - Some(_) => String::new(), - None => String::new(), - } - )); + let host = host.unwrap_or_else(|| { + format!( + "{}.s3{}.amazonaws.com", + bucket, + match region { + Some(ref r) if r != "" => format!("-{}", r), + Some(_) => String::new(), + None => String::new(), + } + ) + }); // Use the custom handler as we always provide an endpoint to connect to. let region = Region::Custom { @@ -190,10 +192,9 @@ impl Uploader { ..Default::default() }; - client - .put_object(req) - .sync() - .chain_error(|| internal(&format_args!("failed to upload to S3: `{}`", path)))?; + client.put_object(req).sync().chain_error(|| { + internal(&format_args!("failed to upload to S3: `{}`", path)) + })?; Ok((Some(String::from(path)), hash)) } @@ -265,10 +266,9 @@ impl Uploader { ..Default::default() }; - client - .delete_object(req) - .sync() - .chain_error(|| internal(&format_args!("failed to upload to S3: `{}`", path)))?; + client.delete_object(req).sync().chain_error(|| { + internal(&format_args!("failed to upload to S3: `{}`", path)) + })?; Ok(()) } From c51818ccdbcba692bd121ef1fedfc3a07e289046 Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Thu, 11 Oct 2018 12:33:00 +0100 Subject: [PATCH 5/8] Rustfmt --- src/bin/populate.rs | 3 +-- src/bin/render-readmes.rs | 12 ++++-------- src/bin/update-downloads.rs | 23 ++++++++--------------- src/boot/categories.rs | 6 ++---- src/controllers/crate_owner_invitation.rs | 3 +-- src/controllers/krate/downloads.rs | 3 +-- src/controllers/krate/follow.rs | 4 +++- src/controllers/krate/metadata.rs | 3 +-- src/controllers/krate/owners.rs | 3 ++- src/controllers/krate/publish.rs | 3 +-- src/controllers/krate/search.rs | 6 ++---- src/controllers/token.rs | 3 ++- src/controllers/user/me.rs | 3 +-- src/controllers/user/other.rs | 3 +-- src/email.rs | 3 +-- src/git.rs | 3 +-- src/github.rs | 3 +-- src/models/badge.rs | 6 +++++- src/models/category.rs | 21 +++++++-------------- src/models/dependency.rs | 3 +-- src/models/keyword.rs | 3 +-- src/models/krate.rs | 17 +++++++---------- src/render.rs | 15 +++++++++------ src/router.rs | 2 +- src/tests/all.rs | 12 +++++------- src/tests/krate.rs | 6 ++---- src/tests/owners.rs | 9 +++------ src/tests/record.rs | 3 +-- 28 files changed, 75 insertions(+), 109 deletions(-) diff --git a/src/bin/populate.rs b/src/bin/populate.rs index b699d03083b..06ca43e8ba6 100644 --- a/src/bin/populate.rs +++ b/src/bin/populate.rs @@ -39,8 +39,7 @@ fn update(conn: &PgConnection) -> QueryResult<()> { version_downloads::version_id.eq(id), version_downloads::downloads.eq(dls), version_downloads::date.eq(date(now - day.days())), - )) - .execute(conn)?; + )).execute(conn)?; } } Ok(()) diff --git a/src/bin/render-readmes.rs b/src/bin/render-readmes.rs index 71b4354b49b..09e1ba0e486 100644 --- a/src/bin/render-readmes.rs +++ b/src/bin/render-readmes.rs @@ -84,8 +84,7 @@ fn main() { readme_renderings::rendered_at .lt(older_than) .or(readme_renderings::version_id.is_null()), - ) - .select(versions::id) + ).select(versions::id) .into_boxed(); if let Some(crate_name) = args.flag_crate { @@ -155,8 +154,7 @@ fn main() { readme.as_bytes(), "text/html", readme_len as u64, - ) - .unwrap_or_else(|_| { + ).unwrap_or_else(|_| { panic!( "[{}-{}] Couldn't upload file to S3", krate_name, version.num @@ -288,16 +286,14 @@ fn find_file_by_path( }; filepath == path } - }) - .unwrap_or_else(|| { + }).unwrap_or_else(|| { panic!( "[{}-{}] couldn't open file: {}", krate_name, version.num, path.display() ) - }) - .unwrap_or_else(|_| { + }).unwrap_or_else(|_| { panic!( "[{}-{}] file is not present: {}", krate_name, diff --git a/src/bin/update-downloads.rs b/src/bin/update-downloads.rs index e9347fda241..7b82a0b1efe 100644 --- a/src/bin/update-downloads.rs +++ b/src/bin/update-downloads.rs @@ -92,8 +92,7 @@ fn collect(conn: &PgConnection, rows: &[VersionDownload]) -> QueryResult<()> { crate_downloads::crate_id.eq(crate_id), crate_downloads::downloads.eq(amt), crate_downloads::date.eq(download.date), - )) - .on_conflict(crate_downloads::table.primary_key()) + )).on_conflict(crate_downloads::table.primary_key()) .do_update() .set(crate_downloads::downloads.eq(crate_downloads::downloads + amt)) .execute(conn)?; @@ -138,7 +137,7 @@ mod test { name: "foo", ..Default::default() }.create_or_update(&conn, None, user_id) - .unwrap(); + .unwrap(); let version = NewVersion::new( krate.id, &semver::Version::parse("1.0.0").unwrap(), @@ -177,8 +176,7 @@ mod test { version_downloads::version_id.eq(version.id), version_downloads::date.eq(date(now - 1.day())), version_downloads::processed.eq(true), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); ::update(&conn).unwrap(); @@ -215,8 +213,7 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now - 2.days())), version_downloads::processed.eq(false), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); ::update(&conn).unwrap(); let processed = version_downloads::table @@ -239,8 +236,7 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now)), version_downloads::processed.eq(false), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); ::update(&conn).unwrap(); let processed = version_downloads::table @@ -273,15 +269,13 @@ mod test { version_downloads::counted.eq(1), version_downloads::date.eq(date(now)), version_downloads::processed.eq(false), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); insert_into(version_downloads::table) .values(( version_downloads::version_id.eq(version.id), version_downloads::date.eq(date(now - 1.day())), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); let version_before = versions::table @@ -337,8 +331,7 @@ mod test { version_downloads::counted.eq(2), version_downloads::date.eq(date(now - 2.days())), version_downloads::processed.eq(false), - )) - .execute(&conn) + )).execute(&conn) .unwrap(); ::update(&conn).unwrap(); diff --git a/src/boot/categories.rs b/src/boot/categories.rs index a64a506003f..669367d4593 100644 --- a/src/boot/categories.rs +++ b/src/boot/categories.rs @@ -107,8 +107,7 @@ pub fn sync_with_connection(toml_str: &str, conn: &PgConnection) -> CargoResult< category.eq(c.name), description.eq(c.description), ) - }) - .collect::>(); + }).collect::>(); conn.transaction(|| { let slugs = diesel::insert_into(categories) @@ -118,8 +117,7 @@ pub fn sync_with_connection(toml_str: &str, conn: &PgConnection) -> CargoResult< .set(( category.eq(excluded(category)), description.eq(excluded(description)), - )) - .returning(slug) + )).returning(slug) .get_results::(&*conn)?; diesel::delete(categories) diff --git a/src/controllers/crate_owner_invitation.rs b/src/controllers/crate_owner_invitation.rs index 26fc8ed1d0f..032475a6b06 100644 --- a/src/controllers/crate_owner_invitation.rs +++ b/src/controllers/crate_owner_invitation.rs @@ -71,8 +71,7 @@ fn accept_invite( owner_id: user_id, created_by: pending_crate_owner.invited_by_user_id, owner_kind: OwnerKind::User as i32, - }) - .on_conflict(crate_owners::table.primary_key()) + }).on_conflict(crate_owners::table.primary_key()) .do_update() .set(crate_owners::deleted.eq(false)) .execute(conn)?; diff --git a/src/controllers/krate/downloads.rs b/src/controllers/krate/downloads.rs index 1af10e71b50..15801c29ba0 100644 --- a/src/controllers/krate/downloads.rs +++ b/src/controllers/krate/downloads.rs @@ -39,8 +39,7 @@ pub fn downloads(req: &mut dyn Request) -> CargoResult { .select(( to_char(version_downloads::date, "YYYY-MM-DD"), sum_downloads, - )) - .filter(version_downloads::date.gt(date(now - 90.days()))) + )).filter(version_downloads::date.gt(date(now - 90.days()))) .group_by(version_downloads::date) .order(version_downloads::date.asc()) .load::(&*conn)?; diff --git a/src/controllers/krate/follow.rs b/src/controllers/krate/follow.rs index 030873e25b0..86fe8c3a676 100644 --- a/src/controllers/krate/follow.rs +++ b/src/controllers/krate/follow.rs @@ -11,7 +11,9 @@ fn follow_target(req: &mut dyn Request) -> CargoResult { let user = req.user()?; let conn = req.db_conn()?; let crate_name = &req.params()["crate_id"]; - let crate_id = Crate::by_name(crate_name).select(crates::id).first(&*conn)?; + let crate_id = Crate::by_name(crate_name) + .select(crates::id) + .first(&*conn)?; Ok(Follow { user_id: user.id, crate_id, diff --git a/src/controllers/krate/metadata.rs b/src/controllers/krate/metadata.rs index 723456d58e3..abef8f9a66e 100644 --- a/src/controllers/krate/metadata.rs +++ b/src/controllers/krate/metadata.rs @@ -34,8 +34,7 @@ pub fn summary(req: &mut dyn Request) -> CargoResult { .zip(krates) .map(|(max_version, krate)| { Ok(krate.minimal_encodable(&max_version, None, false, None)) - }) - .collect() + }).collect() }; let new_crates = crates diff --git a/src/controllers/krate/owners.rs b/src/controllers/krate/owners.rs index eb9e9a2cedb..01d9d773d41 100644 --- a/src/controllers/krate/owners.rs +++ b/src/controllers/krate/owners.rs @@ -95,7 +95,8 @@ fn modify_owners(req: &mut dyn Request, add: bool) -> CargoResult { owners: Option>, } - let request: Request = serde_json::from_str(&body).map_err(|_| human("invalid json request"))?; + let request: Request = + serde_json::from_str(&body).map_err(|_| human("invalid json request"))?; let logins = request .owners diff --git a/src/controllers/krate/publish.rs b/src/controllers/krate/publish.rs index 70058553489..1cc1f327266 100644 --- a/src/controllers/krate/publish.rs +++ b/src/controllers/krate/publish.rs @@ -53,8 +53,7 @@ pub fn publish(req: &mut dyn Request) -> CargoResult { k[..].to_string(), v.iter().map(|v| v[..].to_string()).collect(), ) - }) - .collect::>>(); + }).collect::>>(); let keywords = new_crate .keywords .as_ref() diff --git a/src/controllers/krate/search.rs b/src/controllers/krate/search.rs index 1f966969644..941d34cb86a 100644 --- a/src/controllers/krate/search.rs +++ b/src/controllers/krate/search.rs @@ -48,8 +48,7 @@ pub fn search(req: &mut dyn Request) -> CargoResult { ALL_COLUMNS, false.into_sql::(), recent_crate_downloads::downloads.nullable(), - )) - .into_boxed(); + )).into_boxed(); if let Some(q_string) = params.get("q") { if !q_string.is_empty() { @@ -190,8 +189,7 @@ pub fn search(req: &mut dyn Request) -> CargoResult { Some(recent_downloads), ) }, - ) - .collect(); + ).collect(); #[derive(Serialize)] struct R { diff --git a/src/controllers/token.rs b/src/controllers/token.rs index f8884f97742..b9e62770d77 100644 --- a/src/controllers/token.rs +++ b/src/controllers/token.rs @@ -53,7 +53,8 @@ pub fn new(req: &mut dyn Request) -> CargoResult { let mut json = vec![0; length as usize]; read_fill(req.body(), &mut json)?; - let json = String::from_utf8(json).map_err(|_| bad_request(&"json body was not valid utf-8"))?; + let json = + String::from_utf8(json).map_err(|_| bad_request(&"json body was not valid utf-8"))?; let new: NewApiTokenRequest = json::from_str(&json) .map_err(|e| bad_request(&format!("invalid new token request: {:?}", e)))?; diff --git a/src/controllers/user/me.rs b/src/controllers/user/me.rs index 58a8a07b63d..f1e0e403c18 100644 --- a/src/controllers/user/me.rs +++ b/src/controllers/user/me.rs @@ -34,8 +34,7 @@ pub fn me(req: &mut dyn Request) -> CargoResult { emails::verified.nullable(), emails::email.nullable(), emails::token_generated_at.nullable().is_not_null(), - )) - .first::<(User, Option, Option, bool)>(&*conn)?; + )).first::<(User, Option, Option, bool)>(&*conn)?; let verified = verified.unwrap_or(false); let verification_sent = verified || verification_sent; diff --git a/src/controllers/user/other.rs b/src/controllers/user/other.rs index 9823a3eeef4..ce41c527ffb 100644 --- a/src/controllers/user/other.rs +++ b/src/controllers/user/other.rs @@ -37,8 +37,7 @@ pub fn stats(req: &mut dyn Request) -> CargoResult { crate_owners::owner_id .eq(user_id) .and(crate_owners::owner_kind.eq(OwnerKind::User as i32)), - ) - .select(sum(crates::downloads)) + ).select(sum(crates::downloads)) .first::>(&*conn)? .unwrap_or(0); diff --git a/src/email.rs b/src/email.rs index 6f496c69294..5378c49ba91 100644 --- a/src/email.rs +++ b/src/email.rs @@ -82,8 +82,7 @@ fn send_email(recipient: &str, subject: &str, body: &str) -> CargoResult<()> { .credentials(Credentials::new( mailgun_config.smtp_login, mailgun_config.smtp_password, - )) - .smtp_utf8(true) + )).smtp_utf8(true) .authentication_mechanism(Mechanism::Plain) .build(); diff --git a/src/git.rs b/src/git.rs index bc285065f4d..e500af4bb17 100644 --- a/src/git.rs +++ b/src/git.rs @@ -99,8 +99,7 @@ pub fn yank(app: &App, krate: &str, version: &semver::Version, yanked: bool) -> } git_crate.yanked = Some(yanked); Ok(serde_json::to_string(&git_crate).unwrap()) - }) - .collect::>>(); + }).collect::>>(); let new = new?.join("\n"); let mut f = File::create(&dst)?; f.write_all(new.as_bytes())?; diff --git a/src/github.rs b/src/github.rs index d5226fe9b62..749eeb67faf 100644 --- a/src/github.rs +++ b/src/github.rs @@ -41,8 +41,7 @@ pub fn github(app: &App, url: &str, auth: &Token) -> Result<(Easy, Vec), cur .write_function(|buf| { data.extend_from_slice(buf); Ok(buf.len()) - }) - .unwrap(); + }).unwrap(); transfer.perform()?; } Ok((handle, data)) diff --git a/src/models/badge.rs b/src/models/badge.rs index 9993c9f973a..d622f0fc091 100644 --- a/src/models/badge.rs +++ b/src/models/badge.rs @@ -22,7 +22,11 @@ pub struct CrateBadge { } #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "kebab-case", tag = "badge_type", content = "attributes")] +#[serde( + rename_all = "kebab-case", + tag = "badge_type", + content = "attributes" +)] pub enum Badge { TravisCi { repository: String, diff --git a/src/models/category.rs b/src/models/category.rs index b9b0773ba38..229d054219a 100644 --- a/src/models/category.rs +++ b/src/models/category.rs @@ -118,8 +118,7 @@ impl Category { .map(|c| CrateCategory { category_id: c.id, crate_id: krate.id, - }) - .collect::>(); + }).collect::>(); delete(CrateCategory::belonging_to(krate)).execute(conn)?; insert_into(crates_categories::table) @@ -232,8 +231,7 @@ mod tests { (category.eq("Cat 2"), slug.eq("cat2")), (category.eq("Cat 1"), slug.eq("cat1")), (category.eq("Cat 1::sub"), slug.eq("cat1::sub")), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "", 10, 0) @@ -254,8 +252,7 @@ mod tests { (category.eq("Cat 1"), slug.eq("cat1"), crates_cnt.eq(0)), (category.eq("Cat 2"), slug.eq("cat2"), crates_cnt.eq(2)), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(1)), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 10, 0) @@ -279,8 +276,7 @@ mod tests { .values(&vec![ (category.eq("Cat 1"), slug.eq("cat1")), (category.eq("Cat 2"), slug.eq("cat2")), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "", 1, 0) @@ -324,8 +320,7 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(6)), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 10, 0) @@ -365,8 +360,7 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(6)), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cats = Category::toplevel(&conn, "crates", 2, 0) @@ -420,8 +414,7 @@ mod tests { crates_cnt.eq(5), ), (category.eq("Cat 3"), slug.eq("cat3"), crates_cnt.eq(200)), - ]) - .execute(&conn) + ]).execute(&conn) .unwrap(); let cat = Category::by_slug("cat1::sub1") diff --git a/src/models/dependency.rs b/src/models/dependency.rs index 05defc00ae6..99854e380d3 100644 --- a/src/models/dependency.rs +++ b/src/models/dependency.rs @@ -128,8 +128,7 @@ pub fn add_dependencies( target.eq(dep.target.as_ref().map(|s| &**s)), ), )) - }) - .collect::, _>>()?; + }).collect::, _>>()?; let (git_deps, new_dependencies): (Vec<_>, Vec<_>) = git_and_new_dependencies.into_iter().unzip(); diff --git a/src/models/keyword.rs b/src/models/keyword.rs index 807cc1df18b..d0ca48c4e18 100644 --- a/src/models/keyword.rs +++ b/src/models/keyword.rs @@ -85,8 +85,7 @@ impl Keyword { .map(|kw| CrateKeyword { crate_id: krate.id, keyword_id: kw.id, - }) - .collect::>(); + }).collect::>(); diesel::insert_into(crates_keywords::table) .values(&crate_keywords) .execute(conn)?; diff --git a/src/models/krate.rs b/src/models/krate.rs index 6085bb59436..6c2bd2a5f50 100644 --- a/src/models/krate.rs +++ b/src/models/krate.rs @@ -254,12 +254,11 @@ impl Crate { } fn valid_ident(name: &str) -> bool { - Self::valid_feature_name(name) - && name - .chars() - .nth(0) - .map(char::is_alphabetic) - .unwrap_or(false) + Self::valid_feature_name(name) && name + .chars() + .nth(0) + .map(char::is_alphabetic) + .unwrap_or(false) } pub fn valid_feature_name(name: &str) -> bool { @@ -440,8 +439,7 @@ impl Crate { invited_user_id: owner.id(), invited_by_user_id: req_user.id, crate_id: self.id, - }) - .on_conflict_do_nothing() + }).on_conflict_do_nothing() .execute(conn)?; Ok(format!( "user {} has been invited to be an owner of crate {}", @@ -457,8 +455,7 @@ impl Crate { owner_id: owner.id(), created_by: req_user.id, owner_kind: OwnerKind::Team as i32, - }) - .on_conflict(crate_owners::table.primary_key()) + }).on_conflict(crate_owners::table.primary_key()) .do_update() .set(crate_owners::deleted.eq(false)) .execute(conn)?; diff --git a/src/render.rs b/src/render.rs index 2a0134e6ba3..8580265d25d 100644 --- a/src/render.rs +++ b/src/render.rs @@ -56,7 +56,8 @@ impl<'a> MarkdownRenderer<'a> { "ul", "hr", "span", - ].iter() + ] + .iter() .cloned() .collect(); let tag_attributes = [ @@ -72,7 +73,8 @@ impl<'a> MarkdownRenderer<'a> { "input", ["checked", "disabled", "type"].iter().cloned().collect(), ), - ].iter() + ] + .iter() .cloned() .collect(); let allowed_classes = [( @@ -92,10 +94,12 @@ impl<'a> MarkdownRenderer<'a> { "language-scss", "language-sql", "yaml", - ].iter() + ] + .iter() .cloned() .collect(), - )].iter() + )] + .iter() .cloned() .collect(); @@ -178,8 +182,7 @@ impl<'a> MarkdownRenderer<'a> { UrlRelative::Custom(Box::new(relative_url_sanitizer)) } else { UrlRelative::Custom(Box::new(unrelative_url_sanitizer)) - }) - .id_prefix(Some("user-content-")); + }).id_prefix(Some("user-content-")); MarkdownRenderer { html_sanitizer } } diff --git a/src/router.rs b/src/router.rs index c287f8dafc3..c44d8837ea4 100644 --- a/src/router.rs +++ b/src/router.rs @@ -220,7 +220,7 @@ mod tests { 0, 0 ))).call(&mut req) - .is_err() + .is_err() ); assert!( C(|_| err(::std::io::Error::new(::std::io::ErrorKind::Other, ""))) diff --git a/src/tests/all.rs b/src/tests/all.rs index 4eb6c5df159..af99432b0d6 100644 --- a/src/tests/all.rs +++ b/src/tests/all.rs @@ -333,8 +333,7 @@ impl<'a> VersionBuilder<'a> { dependencies::default_features.eq(false), dependencies::features.eq(Vec::::new()), ) - }) - .collect::>(); + }).collect::>(); insert_into(dependencies::table) .values(&new_deps) .execute(connection)?; @@ -556,8 +555,7 @@ fn new_dependency(conn: &PgConnection, version: &Version, krate: &Crate) -> Depe optional.eq(false), default_features.eq(false), features.eq(Vec::::new()), - )) - .get_result(conn) + )).get_result(conn) .unwrap() } @@ -693,8 +691,7 @@ fn new_crate_to_body(new_crate: &u::NewCrate, files: &[(&str, &[u8])]) -> Vec>(); + }).collect::>(); new_crate_to_body_with_io(new_crate, &mut files) } @@ -726,7 +723,8 @@ fn new_crate_to_body_with_tarball(new_crate: &u::NewCrate, tarball: &[u8]) -> Ve (json.len() >> 8) as u8, (json.len() >> 16) as u8, (json.len() >> 24) as u8, - ].iter() + ] + .iter() .cloned(), ); body.extend(json.as_bytes().iter().cloned()); diff --git a/src/tests/krate.rs b/src/tests/krate.rs index 3a70b8dcccc..65c8ae03f26 100644 --- a/src/tests/krate.rs +++ b/src/tests/krate.rs @@ -1095,8 +1095,7 @@ fn new_krate_git_upload_appends() { .write_all( br#"{"name":"FPP","vers":"0.0.1","deps":[],"features":{},"cksum":"3j3"} "#, - ) - .unwrap(); + ).unwrap(); let mut req = new_req("FPP", "1.0.0"); sign_in(&mut req, &app); @@ -1938,8 +1937,7 @@ fn reverse_dependencies() { VersionBuilder::new("1.1.0") .dependency(&c1, None) .dependency(&c1, Some("foo")), - ) - .expect_build(&conn); + ).expect_build(&conn); } let mut response = ok_resp!(middle.call(&mut req)); diff --git a/src/tests/owners.rs b/src/tests/owners.rs index eb61a7af64a..2e1ae1e900e 100644 --- a/src/tests/owners.rs +++ b/src/tests/owners.rs @@ -319,8 +319,7 @@ fn invitations_list() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }) - .execute(&*conn) + }).execute(&*conn) .unwrap(); (krate, user) }; @@ -376,8 +375,7 @@ fn test_accept_invitation() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }) - .execute(&*conn) + }).execute(&*conn) .unwrap(); (krate, user) }; @@ -467,8 +465,7 @@ fn test_decline_invitation() { invited_by_user_id: owner.id, invited_user_id: user.id, crate_id: krate.id, - }) - .execute(&*conn) + }).execute(&*conn) .unwrap(); (krate, user) }; diff --git a/src/tests/record.rs b/src/tests/record.rs index a5491f2561e..cb347e483c3 100644 --- a/src/tests/record.rs +++ b/src/tests/record.rs @@ -122,8 +122,7 @@ pub fn proxy() -> (String, Bomb) { sink: sink2, record: Arc::clone(&record), client, - }) - .map_err(|e| eprintln!("server connection error: {}", e)); + }).map_err(|e| eprintln!("server connection error: {}", e)); drop(core.run(srv.select2(quitrx))); From 90e043f4aa4d2433713a4948089bc3f37e86f5c1 Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Fri, 12 Oct 2018 08:24:03 +0100 Subject: [PATCH 6/8] Get tests compiling again. --- src/config.rs | 6 ++++++ src/tests/all.rs | 21 +++++++++------------ src/uploaders.rs | 7 +++++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/config.rs b/src/config.rs index 516c390e039..fb91ffad08e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -67,7 +67,9 @@ impl Default for Config { env("S3_ACCESS_KEY"), env("S3_SECRET_KEY"), env::var("S3_HOST").ok(), + "https".to_string(), env::var("S3_CDN").ok(), + None, ) } (Env::Production, Replica::ReadOnlyMirror) => { @@ -85,7 +87,9 @@ impl Default for Config { env::var("S3_ACCESS_KEY").unwrap_or_default(), env::var("S3_SECRET_KEY").unwrap_or_default(), env::var("S3_HOST").ok(), + "https".to_string(), env::var("S3_CDN").ok(), + None, ) } // In Development mode, either running as a primary instance or a read-only mirror @@ -103,7 +107,9 @@ impl Default for Config { env::var("S3_ACCESS_KEY").unwrap_or_default(), env::var("S3_SECRET_KEY").unwrap_or_default(), env::var("S3_HOST").ok(), + "https".to_string(), env::var("S3_CDN").ok(), + None, ) } else { // If we don't set the `S3_BUCKET` variable, we'll use a development-only diff --git a/src/tests/all.rs b/src/tests/all.rs index af99432b0d6..87deab47a80 100644 --- a/src/tests/all.rs +++ b/src/tests/all.rs @@ -17,7 +17,6 @@ extern crate flate2; extern crate git2; #[macro_use] extern crate lazy_static; -extern crate s3; extern crate semver; extern crate serde; #[macro_use] @@ -143,17 +142,15 @@ fn app() -> ( // sniff/record it, but everywhere else we use https let api_protocol = String::from("http"); - let uploader = cargo_registry::Uploader::S3 { - bucket: s3::Bucket::new( - String::from("alexcrichton-test"), - None, - std::env::var("S3_ACCESS_KEY").unwrap_or_default(), - std::env::var("S3_SECRET_KEY").unwrap_or_default(), - &api_protocol, - ), - proxy: Some(proxy), - cdn: None, - }; + let uploader = cargo_registry::Uploader::new_s3( + String::from("alexcrichton-test"), + None, + std::env::var("S3_ACCESS_KEY").unwrap_or_default(), + std::env::var("S3_SECRET_KEY").unwrap_or_default(), + None, + api_protocol.clone(), + None, + Some(proxy)); let config = cargo_registry::Config { uploader, diff --git a/src/uploaders.rs b/src/uploaders.rs index 5b80aae099a..b237a78e74c 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -64,11 +64,14 @@ impl Uploader { access_key: String, secret_key: String, host: Option, + proto: String, cdn: Option, + proxy: Option, ) -> Uploader { let host = host.unwrap_or_else(|| { format!( - "{}.s3{}.amazonaws.com", + "{}://{}.s3{}.amazonaws.com", + proto, bucket, match region { Some(ref r) if r != "" => format!("-{}", r), @@ -94,7 +97,7 @@ impl Uploader { bucket, host, cdn, - proxy: None, + proxy, } } From a949f28ee83bde83087a46be6fae78031537a64a Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Mon, 15 Oct 2018 17:00:14 +0100 Subject: [PATCH 7/8] Hopefully should be green CI now --- src/config.rs | 47 ++++++++---------- src/lib.rs | 2 +- src/tests/all.rs | 13 ++--- src/uploaders.rs | 127 +++++++++++++++++++++++++++++++---------------- 4 files changed, 113 insertions(+), 76 deletions(-) diff --git a/src/config.rs b/src/config.rs index fb91ffad08e..a44a9f17205 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ use std::env; use std::path::PathBuf; -use {env, Env, Replica, Uploader}; +use {env, Env, Replica, S3UploaderBuilder, Uploader}; #[derive(Clone, Debug)] pub struct Config { @@ -61,16 +61,11 @@ impl Default for Config { // `env` panics if these vars are not set, and in production for a primary instance, // that's what we want since we don't want to be able to start the server if the // server doesn't know where to upload crates. - Uploader::new_s3( - env("S3_BUCKET"), - env::var("S3_REGION").ok(), - env("S3_ACCESS_KEY"), - env("S3_SECRET_KEY"), - env::var("S3_HOST").ok(), - "https".to_string(), - env::var("S3_CDN").ok(), - None, - ) + S3UploaderBuilder::new(env("S3_BUCKET"), env("S3_ACCESS_KEY"), env("S3_SECRET_KEY")) + .region(env::var("S3_REGION").ok()) + .host(env::var("S3_HOST").ok()) + .cdn(env::var("S3_CDN").ok()) + .build() } (Env::Production, Replica::ReadOnlyMirror) => { // Read-only mirrors don't need access key or secret key since by definition, @@ -81,16 +76,17 @@ impl Default for Config { // // Read-only mirrors definitely need bucket though, so that they know where // to serve crate files from. - Uploader::new_s3( + let mut s3_builder = S3UploaderBuilder::new( env("S3_BUCKET"), - env::var("S3_REGION").ok(), env::var("S3_ACCESS_KEY").unwrap_or_default(), env::var("S3_SECRET_KEY").unwrap_or_default(), - env::var("S3_HOST").ok(), - "https".to_string(), - env::var("S3_CDN").ok(), - None, - ) + ); + + s3_builder + .region(env::var("S3_REGION").ok()) + .host(env::var("S3_HOST").ok()) + .cdn(env::var("S3_CDN").ok()) + .build() } // In Development mode, either running as a primary instance or a read-only mirror _ => { @@ -101,16 +97,17 @@ impl Default for Config { // optional, like production read-only mirrors. println!("Using S3 uploader"); - Uploader::new_s3( + let mut s3_builder = S3UploaderBuilder::new( env("S3_BUCKET"), - env::var("S3_REGION").ok(), env::var("S3_ACCESS_KEY").unwrap_or_default(), env::var("S3_SECRET_KEY").unwrap_or_default(), - env::var("S3_HOST").ok(), - "https".to_string(), - env::var("S3_CDN").ok(), - None, - ) + ); + + s3_builder + .region(env::var("S3_REGION").ok()) + .host(env::var("S3_HOST").ok()) + .cdn(env::var("S3_CDN").ok()) + .build() } else { // If we don't set the `S3_BUCKET` variable, we'll use a development-only // uploader that makes it possible to run and publish to a locally-running diff --git a/src/lib.rs b/src/lib.rs index 78a80fb9167..a6545468a88 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,7 @@ extern crate conduit_router; extern crate conduit_static; extern crate cookie; -pub use self::uploaders::{Bomb, Uploader}; +pub use self::uploaders::{Bomb, S3UploaderBuilder, Uploader}; pub use app::App; pub use config::Config; diff --git a/src/tests/all.rs b/src/tests/all.rs index 87deab47a80..ba4d1c7cfde 100644 --- a/src/tests/all.rs +++ b/src/tests/all.rs @@ -142,15 +142,16 @@ fn app() -> ( // sniff/record it, but everywhere else we use https let api_protocol = String::from("http"); - let uploader = cargo_registry::Uploader::new_s3( + let s3_builder = cargo_registry::S3UploaderBuilder::new( String::from("alexcrichton-test"), - None, std::env::var("S3_ACCESS_KEY").unwrap_or_default(), std::env::var("S3_SECRET_KEY").unwrap_or_default(), - None, - api_protocol.clone(), - None, - Some(proxy)); + ); + + let uploader = s3_builder + .proto(String::from("http")) + .proxy(Some(proxy)) + .build(); let config = cargo_registry::Config { uploader, diff --git a/src/uploaders.rs b/src/uploaders.rs index b237a78e74c..5c01096eab4 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -57,50 +57,6 @@ impl fmt::Debug for Uploader { } impl Uploader { - /// Creates a new S3 uploader object. - pub fn new_s3( - bucket: String, - region: Option, - access_key: String, - secret_key: String, - host: Option, - proto: String, - cdn: Option, - proxy: Option, - ) -> Uploader { - let host = host.unwrap_or_else(|| { - format!( - "{}://{}.s3{}.amazonaws.com", - proto, - bucket, - match region { - Some(ref r) if r != "" => format!("-{}", r), - Some(_) => String::new(), - None => String::new(), - } - ) - }); - - // Use the custom handler as we always provide an endpoint to connect to. - let region = Region::Custom { - name: region.unwrap_or_else(|| "us-east-1".to_string()), - endpoint: host.clone(), - }; - - let dispatcher = HttpClient::new().expect("failed to create request dispatcher"); - let credentials = S3CredentialsProvider::new(access_key, secret_key); - - let s3client = S3Client::new_with(dispatcher, credentials, region); - - Uploader::S3 { - client: Arc::new(s3client), - bucket, - host, - cdn, - proxy, - } - } - pub fn proxy(&self) -> Option<&str> { match *self { Uploader::S3 { ref proxy, .. } => proxy.as_ref().map(String::as_str), @@ -327,6 +283,89 @@ impl ProvideAwsCredentials for S3CredentialsProvider { } } +#[derive(Clone, Debug, Default)] +pub struct S3UploaderBuilder { + bucket: String, + access_key: String, + secret_key: String, + proto: String, + region: Option, + host: Option, + cdn: Option, + proxy: Option, +} + +impl S3UploaderBuilder { + pub fn new(bucket: String, access_key: String, secret_key: String) -> S3UploaderBuilder { + S3UploaderBuilder { + bucket, + access_key, + secret_key, + proto: "https".into(), + ..Default::default() + } + } + + pub fn proto(mut self, proto: String) -> S3UploaderBuilder { + self.proto = proto; + self + } + + pub fn region(mut self, region: Option) -> S3UploaderBuilder { + self.region = region; + self + } + + pub fn host(mut self, host: Option) -> S3UploaderBuilder { + self.host = host; + self + } + + pub fn cdn(mut self, cdn: Option) -> S3UploaderBuilder { + self.cdn = cdn; + self + } + + pub fn proxy(mut self, proxy: Option) -> S3UploaderBuilder { + self.proxy = proxy; + self + } + + pub fn build(self) -> Uploader { + let host = self.host.clone().unwrap_or_else(|| { + format!( + "{}://{}.s3{}.amazonaws.com", + self.proto, + self.bucket, + match self.region { + Some(ref r) if r != "" => format!("-{}", r), + Some(_) => String::new(), + None => String::new(), + } + ) + }); + + // Use the custom handler as we always provide an endpoint to connect to. + let region = Region::Custom { + name: self.region.unwrap_or_else(|| "us-east-1".to_string()), + endpoint: host.clone(), + }; + + let dispatcher = HttpClient::new().expect("failed to create request dispatcher"); + let credentials = S3CredentialsProvider::new(self.access_key, self.secret_key); + + let s3client = S3Client::new_with(dispatcher, credentials, region); + + Uploader::S3 { + client: Arc::new(s3client), + bucket: self.bucket, + host, + cdn: self.cdn, + proxy: self.proxy, + } + } +} + // Can't derive Debug because of App. #[allow(missing_debug_implementations)] pub struct Bomb { From 31ede73aabd370a2b875ce2f327e154be695daf9 Mon Sep 17 00:00:00 2001 From: Christopher Swindle Date: Mon, 15 Oct 2018 19:07:57 +0100 Subject: [PATCH 8/8] Sorting out uploaders post merge. --- src/uploaders.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uploaders.rs b/src/uploaders.rs index 1034f7a4f84..5b575813e51 100644 --- a/src/uploaders.rs +++ b/src/uploaders.rs @@ -145,7 +145,6 @@ impl Uploader { bucket: bucket.to_string(), key: path.to_string(), content_type: Some(content_type.to_string()), - content_length: Some(file_length as i64), body: Some(body.to_vec().into()), ..Default::default() }; @@ -184,7 +183,7 @@ impl Uploader { let mut body = Vec::new(); LimitErrorReader::new(req.body(), maximums.max_upload_size).read_to_end(&mut body)?; verify_tarball(krate, vers, &body, maximums.max_unpack_size)?; - self.upload(&path, &body, "application/x-tar", u64::from(file_length))? + self.upload(&path, body, "application/x-tar")? }; // We create the bomb for the crate file before uploading the readme so that if the // readme upload fails, the uploaded crate file is automatically deleted. @@ -194,8 +193,7 @@ impl Uploader { }; let (readme_path, _) = if let Some(rendered) = readme { let path = Uploader::readme_path(&krate.name, &vers.to_string()); - let length = rendered.len(); - self.upload(&path, rendered.as_bytes(), "text/html", length as u64)? + self.upload(&path, rendered.as_bytes().to_vec(), "text/html")? } else { (None, vec![]) };