Skip to content

Commit 487166c

Browse files
Merge #1263
1263: Update dependencies r=carols10cents This PR was constructed in two phases. The first 3 commits make up phase 1 where most semver compatible versions are bumped. In the second phase I started bumping requirements in `Cargo.toml`. ## Phase 1 The first 3 commits essentially do a `cargo update` with the exception of `hyper` which is held back at 0.11.10. A deprecation was introduced in 0.11.11. It looks like `bind_connection` should be replaced with `serve_connection`, however the API is different. The first two commits account for: * A minor change to the GNU header format in `tar`. It appears that this test is the only one we have that successfully uploads a tar file containing file contents, thus triggering the inclusion of the header. * A deprecation in `openssl`. ## Phase 2 The following updates required minor fixes to address API changes: `flate2`, `env_logger`, `openssl`, `hex`, `lettre`.
2 parents 4ad168f + 822735e commit 487166c

File tree

13 files changed

+703
-511
lines changed

13 files changed

+703
-511
lines changed

Cargo.lock

+659-466
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+12-10
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ rustdoc-args = [
2828

2929
[dependencies]
3030
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
31-
rand = "0.3"
31+
rand = "0.4"
3232
git2 = "0.6.4"
33-
flate2 = "0.2"
33+
flate2 = "1.0"
3434
semver = "0.5"
35-
url = "1.2.1"
35+
url = "1.2"
3636
tar = "0.4.13"
3737

38-
openssl = "0.9.14"
38+
openssl = "0.10.0"
3939
curl = "0.4"
4040
oauth2 = "0.3"
4141
log = "0.3"
42-
env_logger = "0.4"
43-
hex = "0.2"
42+
env_logger = "0.5"
43+
hex = "0.3"
4444
htmlescape = "0.3.1"
4545
license-exprs = "^1.3"
46-
dotenv = "0.10.0"
46+
dotenv = "0.11.0"
4747
toml = "0.4"
4848
diesel = { version = "1.1.0", features = ["postgres", "serde_json", "chrono", "r2d2"] }
4949
diesel_full_text_search = "1.0.0"
@@ -54,11 +54,13 @@ chrono = { version = "0.4.0", features = ["serde"] }
5454
comrak = { version = "0.2.3", default-features = false }
5555
ammonia = "1.0.0"
5656
docopt = "0.8.1"
57-
itertools = "0.6.0"
58-
lettre = "0.6"
57+
itertools = "0.7.0"
5958
scheduled-thread-pool = "0.2.0"
6059
derive_deref = "1.0.0"
6160

61+
lettre = "0.7"
62+
lettre_email = "0.7"
63+
6264
conduit = "0.8"
6365
conduit-conditional-get = "0.8"
6466
conduit-cookie = "0.8"
@@ -80,7 +82,7 @@ tokio-core = "0.1"
8082
tokio-service = "0.1"
8183

8284
[build-dependencies]
83-
dotenv = "0.10"
85+
dotenv = "0.11"
8486
diesel = { version = "1.1.0", features = ["postgres"] }
8587
diesel_migrations = { version = "1.1.0", features = ["postgres"] }
8688

src/bin/render-readmes.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
220220
return None;
221221
}
222222
let reader = Cursor::new(response);
223-
let reader = GzDecoder::new(reader).expect(&format!(
224-
"[{}-{}] Invalid gzip header",
225-
krate_name, version.num
226-
));
223+
let reader = GzDecoder::new(reader);
227224
let mut archive = Archive::new(reader);
228225
let mut entries = archive.entries().expect(&format!(
229226
"[{}-{}] Invalid tar archive entries",

src/bin/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::sync::mpsc::channel;
1515
#[allow(dead_code)]
1616
fn main() {
1717
// Initialize logging
18-
env_logger::init().unwrap();
18+
env_logger::init();
1919
let config: cargo_registry::Config = Default::default();
2020

2121
// If there isn't a git checkout containing the crate index repo at the path specified

src/controllers/krate/publish.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ pub fn publish(req: &mut Request) -> CargoResult<Response> {
140140
.upload_crate(req, &krate, readme, max, max_unpack, vers)?;
141141
version.record_readme_rendering(&conn)?;
142142

143+
let mut hex_cksum = String::new();
144+
cksum.write_hex(&mut hex_cksum)?;
145+
143146
// Register this crate in our local git repo.
144147
let git_crate = git::Crate {
145148
name: name.to_string(),
146149
vers: vers.to_string(),
147-
cksum: cksum.to_hex(),
150+
cksum: hex_cksum,
148151
features: features,
149152
deps: git_deps,
150153
yanked: Some(false),

src/email.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ use dotenv::dotenv;
22
use std::env;
33
use std::path::Path;
44
use util::{bad_request, CargoResult};
5-
use lettre::email::{Email, EmailBuilder};
6-
use lettre::transport::file::FileEmailTransport;
7-
use lettre::transport::EmailTransport;
8-
use lettre::transport::smtp::{SecurityLevel, SmtpTransportBuilder};
9-
use lettre::transport::smtp::SUBMISSION_PORT;
10-
use lettre::transport::smtp::authentication::Mechanism;
5+
6+
use lettre::file::FileEmailTransport;
7+
use lettre::EmailTransport;
8+
use lettre::smtp::SmtpTransport;
9+
use lettre::smtp::authentication::{Credentials, Mechanism};
10+
11+
use lettre_email::{Email, EmailBuilder};
1112

1213
#[derive(Debug)]
1314
pub struct MailgunConfigVars {
@@ -60,20 +61,21 @@ pub fn send_email(recipient: &str, subject: &str, body: &str) -> CargoResult<()>
6061

6162
match mailgun_config {
6263
Some(mailgun_config) => {
63-
let mut transport =
64-
SmtpTransportBuilder::new((mailgun_config.smtp_server.as_str(), SUBMISSION_PORT))?
65-
.credentials(&mailgun_config.smtp_login, &mailgun_config.smtp_password)
66-
.security_level(SecurityLevel::AlwaysEncrypt)
67-
.smtp_utf8(true)
68-
.authentication_mechanism(Mechanism::Plain)
69-
.build();
64+
let mut transport = SmtpTransport::simple_builder(mailgun_config.smtp_server)?
65+
.credentials(Credentials::new(
66+
mailgun_config.smtp_login,
67+
mailgun_config.smtp_password,
68+
))
69+
.smtp_utf8(true)
70+
.authentication_mechanism(Mechanism::Plain)
71+
.build();
7072

71-
let result = transport.send(email.clone());
73+
let result = transport.send(&email);
7274
result.map_err(|_| bad_request("Error in sending email"))?;
7375
}
7476
None => {
7577
let mut sender = FileEmailTransport::new(Path::new("/tmp"));
76-
let result = sender.send(email.clone());
78+
let result = sender.send(&email);
7779
result.map_err(|_| bad_request("Email file could not be generated"))?;
7880
}
7981
}

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern crate git2;
2222
extern crate hex;
2323
extern crate htmlescape;
2424
extern crate lettre;
25+
extern crate lettre_email;
2526
extern crate license_exprs;
2627
#[macro_use]
2728
extern crate log;

src/s3/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "s3"
1313
path = "lib.rs"
1414

1515
[dependencies]
16-
openssl = "0.9"
16+
openssl = "0.10"
1717
chrono = "0.4"
1818
curl = "0.4"
19-
base64 = "0.6"
19+
base64 = "0.9"

src/s3/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl Bucket {
134134
let key = PKey::hmac(self.secret_key.as_bytes()).unwrap();
135135
let mut signer = Signer::new(MessageDigest::sha1(), &key).unwrap();
136136
signer.update(string.as_bytes()).unwrap();
137-
encode(&signer.finish().unwrap()[..])
137+
encode(&signer.sign_to_vec().unwrap()[..])
138138
};
139139
format!("AWS {}:{}", self.access_key, signature)
140140
}

src/tests/all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ fn new_crate_to_body_with_io(
685685
) -> Vec<u8> {
686686
let mut tarball = Vec::new();
687687
{
688-
let mut ar = tar::Builder::new(GzEncoder::new(&mut tarball, Compression::Default));
688+
let mut ar = tar::Builder::new(GzEncoder::new(&mut tarball, Compression::default()));
689689
for &mut (name, ref mut data, size) in files {
690690
let mut header = tar::Header::new_gnu();
691691
t!(header.set_path(name));
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"request":{"uri":"http://alexcrichton-test.s3.amazonaws.com/crates/foo_whitelist/foo_whitelist-1.1.0.crate","method":"PUT","headers":[["Authorization","AWS AKIAICL5IWUZYWWKA7JA:qt4nSgvxT4p0mzUU9mA+lDtnKdE="],["Proxy-Connection","Keep-Alive"],["Date","Fri, 15 Sep 2017 07:53:06 -0700"],["Accept","*/*"],["Content-Type","application/x-tar"],["Host","alexcrichton-test.s3.amazonaws.com"],["Content-Length","95"]],"body":[31,139,8,0,0,0,0,0,0,255,237,200,61,10,128,48,12,6,208,28,37,23,176,166,10,237,113,164,130,63,1,161,96,35,94,223,193,205,201,169,32,126,111,124,115,206,195,185,170,77,155,22,107,188,243,78,218,81,23,170,65,110,125,236,228,249,33,72,100,170,225,40,150,118,102,250,169,4,0,0,0,159,71,0,0,47,93,157,95,173,158,0,14,0,0]},"response":{"status":200,"headers":[["Date","Fri, 15 Sep 2017 14:53:07 GMT"],["x-amz-request-id","A154F439BE2F1178"],["Server","AmazonS3"],["ETag","\"9facb520b24bd39bb1ee070422257b83\""],["x-amz-id-2","sJQf1gwHhtO9UupUzVzcH5l1yvS64tKrNFy59yuhFRCrLpSEGAAm/S4LNhUDFCqS2HOsyw0FXBo="],["Content-Length","0"]],"body":[]}}]
1+
[{"request":{"uri":"http://alexcrichton-test.s3.amazonaws.com/crates/foo_whitelist/foo_whitelist-1.1.0.crate","method":"PUT","headers":[["Authorization","AWS AKIAICL5IWUZYWWKA7JA:qt4nSgvxT4p0mzUU9mA+lDtnKdE="],["Proxy-Connection","Keep-Alive"],["Date","Fri, 15 Sep 2017 07:53:06 -0700"],["Accept","*/*"],["Content-Type","application/x-tar"],["Host","alexcrichton-test.s3.amazonaws.com"],["Content-Length","96"]],"body":[31, 139, 8, 0, 0, 0, 0, 0, 0, 255, 237, 198, 77, 10, 128, 32, 16, 6, 208, 57, 138, 23, 200, 212, 160, 57, 78, 24, 244, 51, 16, 8, 57, 209, 245, 67, 162, 125, 43, 33, 250, 222, 234, 205, 41, 13, 231, 42, 58, 109, 146, 181, 241, 214, 91, 215, 142, 178, 80, 13, 238, 214, 113, 112, 207, 139, 114, 238, 3, 83, 21, 71, 214, 184, 27, 67, 63, 21, 1, 0, 0, 224, 243, 8, 0, 224, 165, 11, 110, 88, 191, 250, 0, 14, 0, 0]},"response":{"status":200,"headers":[["Date","Fri, 15 Sep 2017 14:53:07 GMT"],["x-amz-request-id","A154F439BE2F1178"],["Server","AmazonS3"],["ETag","\"9facb520b24bd39bb1ee070422257b83\""],["x-amz-id-2","sJQf1gwHhtO9UupUzVzcH5l1yvS64tKrNFy59yuhFRCrLpSEGAAm/S4LNhUDFCqS2HOsyw0FXBo="],["Content-Length","0"]],"body":[]}}]

src/uploaders.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn verify_tarball(
247247
max_unpack: u64,
248248
) -> CargoResult<()> {
249249
// All our data is currently encoded with gzip
250-
let decoder = GzDecoder::new(tarball)?;
250+
let decoder = GzDecoder::new(tarball);
251251

252252
// Don't let gzip decompression go into the weeeds, apply a fixed cap after
253253
// which point we say the decompressed source is "too large".

src/util/hasher.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use openssl::hash::{Hasher, MessageDigest};
55
pub fn hash(data: &[u8]) -> Vec<u8> {
66
let mut hasher = Hasher::new(MessageDigest::sha256()).unwrap();
77
hasher.update(data).unwrap();
8-
hasher.finish2().unwrap().to_vec()
8+
hasher.finish().unwrap().to_vec()
99
}
1010

1111
// Can't derive debug because of Hasher.
@@ -24,13 +24,7 @@ impl<R: Read> HashingReader<R> {
2424
}
2525

2626
pub fn finalize(mut self) -> Vec<u8> {
27-
/*
28-
rustfmt wanted to merge the lines together so had to use this
29-
to stop this from occurring
30-
*/
31-
#[cfg_attr(rustfmt, rustfmt_skip)]
32-
#[allow(deprecated)]
33-
self.hasher.finish().unwrap()
27+
self.hasher.finish().unwrap().to_vec()
3428
}
3529
}
3630

0 commit comments

Comments
 (0)