Skip to content

Update dependencies #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 8, 2018
1,125 changes: 659 additions & 466 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ rustdoc-args = [

[dependencies]
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
rand = "0.3"
rand = "0.4"
git2 = "0.6.4"
flate2 = "0.2"
flate2 = "1.0"
semver = "0.5"
url = "1.2.1"
url = "1.2"
tar = "0.4.13"

openssl = "0.9.14"
openssl = "0.10.0"
curl = "0.4"
oauth2 = "0.3"
log = "0.3"
env_logger = "0.4"
hex = "0.2"
env_logger = "0.5"
hex = "0.3"
htmlescape = "0.3.1"
license-exprs = "^1.3"
dotenv = "0.10.0"
dotenv = "0.11.0"
toml = "0.4"
diesel = { version = "1.1.0", features = ["postgres", "serde_json", "chrono", "r2d2"] }
diesel_full_text_search = "1.0.0"
Expand All @@ -54,11 +54,13 @@ chrono = { version = "0.4.0", features = ["serde"] }
comrak = { version = "0.2.3", default-features = false }
ammonia = "1.0.0"
docopt = "0.8.1"
itertools = "0.6.0"
lettre = "0.6"
itertools = "0.7.0"
scheduled-thread-pool = "0.2.0"
derive_deref = "1.0.0"

lettre = "0.7"
lettre_email = "0.7"

conduit = "0.8"
conduit-conditional-get = "0.8"
conduit-cookie = "0.8"
Expand All @@ -80,7 +82,7 @@ tokio-core = "0.1"
tokio-service = "0.1"

[build-dependencies]
dotenv = "0.10"
dotenv = "0.11"
diesel = { version = "1.1.0", features = ["postgres"] }
diesel_migrations = { version = "1.1.0", features = ["postgres"] }

Expand Down
5 changes: 1 addition & 4 deletions src/bin/render-readmes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ fn get_readme(config: &Config, version: &Version, krate_name: &str) -> Option<St
return None;
}
let reader = Cursor::new(response);
let reader = GzDecoder::new(reader).expect(&format!(
"[{}-{}] Invalid gzip header",
krate_name, version.num
));
let reader = GzDecoder::new(reader);
let mut archive = Archive::new(reader);
let mut entries = archive.entries().expect(&format!(
"[{}-{}] Invalid tar archive entries",
Expand Down
2 changes: 1 addition & 1 deletion src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::sync::mpsc::channel;
#[allow(dead_code)]
fn main() {
// Initialize logging
env_logger::init().unwrap();
env_logger::init();
let config: cargo_registry::Config = Default::default();

// If there isn't a git checkout containing the crate index repo at the path specified
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/krate/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,14 @@ pub fn publish(req: &mut Request) -> CargoResult<Response> {
.upload_crate(req, &krate, readme, max, max_unpack, vers)?;
version.record_readme_rendering(&conn)?;

let mut hex_cksum = String::new();
cksum.write_hex(&mut hex_cksum)?;

// Register this crate in our local git repo.
let git_crate = git::Crate {
name: name.to_string(),
vers: vers.to_string(),
cksum: cksum.to_hex(),
cksum: hex_cksum,
features: features,
deps: git_deps,
yanked: Some(false),
Expand Down
32 changes: 17 additions & 15 deletions src/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use dotenv::dotenv;
use std::env;
use std::path::Path;
use util::{bad_request, CargoResult};
use lettre::email::{Email, EmailBuilder};
use lettre::transport::file::FileEmailTransport;
use lettre::transport::EmailTransport;
use lettre::transport::smtp::{SecurityLevel, SmtpTransportBuilder};
use lettre::transport::smtp::SUBMISSION_PORT;
use lettre::transport::smtp::authentication::Mechanism;

use lettre::file::FileEmailTransport;
use lettre::EmailTransport;
use lettre::smtp::SmtpTransport;
use lettre::smtp::authentication::{Credentials, Mechanism};

use lettre_email::{Email, EmailBuilder};

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

match mailgun_config {
Some(mailgun_config) => {
let mut transport =
SmtpTransportBuilder::new((mailgun_config.smtp_server.as_str(), SUBMISSION_PORT))?
.credentials(&mailgun_config.smtp_login, &mailgun_config.smtp_password)
.security_level(SecurityLevel::AlwaysEncrypt)
.smtp_utf8(true)
.authentication_mechanism(Mechanism::Plain)
.build();
let mut transport = SmtpTransport::simple_builder(mailgun_config.smtp_server)?
.credentials(Credentials::new(
mailgun_config.smtp_login,
mailgun_config.smtp_password,
))
.smtp_utf8(true)
.authentication_mechanism(Mechanism::Plain)
.build();

let result = transport.send(email.clone());
let result = transport.send(&email);
result.map_err(|_| bad_request("Error in sending email"))?;
}
None => {
let mut sender = FileEmailTransport::new(Path::new("/tmp"));
let result = sender.send(email.clone());
let result = sender.send(&email);
result.map_err(|_| bad_request("Email file could not be generated"))?;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern crate git2;
extern crate hex;
extern crate htmlescape;
extern crate lettre;
extern crate lettre_email;
extern crate license_exprs;
#[macro_use]
extern crate log;
Expand Down
4 changes: 2 additions & 2 deletions src/s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = "s3"
path = "lib.rs"

[dependencies]
openssl = "0.9"
openssl = "0.10"
chrono = "0.4"
curl = "0.4"
base64 = "0.6"
base64 = "0.9"
2 changes: 1 addition & 1 deletion src/s3/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Bucket {
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.finish().unwrap()[..])
encode(&signer.sign_to_vec().unwrap()[..])
};
format!("AWS {}:{}", self.access_key, signature)
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ fn new_crate_to_body_with_io(
) -> Vec<u8> {
let mut tarball = Vec::new();
{
let mut ar = tar::Builder::new(GzEncoder::new(&mut tarball, Compression::Default));
let mut ar = tar::Builder::new(GzEncoder::new(&mut tarball, Compression::default()));
for &mut (name, ref mut data, size) in files {
let mut header = tar::Header::new_gnu();
t!(header.set_path(name));
Expand Down
Original file line number Diff line number Diff line change
@@ -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":[]}}]
[{"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":[]}}]
2 changes: 1 addition & 1 deletion src/uploaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn verify_tarball(
max_unpack: u64,
) -> CargoResult<()> {
// All our data is currently encoded with gzip
let decoder = GzDecoder::new(tarball)?;
let decoder = GzDecoder::new(tarball);

// Don't let gzip decompression go into the weeeds, apply a fixed cap after
// which point we say the decompressed source is "too large".
Expand Down
10 changes: 2 additions & 8 deletions src/util/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use openssl::hash::{Hasher, MessageDigest};
pub fn hash(data: &[u8]) -> Vec<u8> {
let mut hasher = Hasher::new(MessageDigest::sha256()).unwrap();
hasher.update(data).unwrap();
hasher.finish2().unwrap().to_vec()
hasher.finish().unwrap().to_vec()
}

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

pub fn finalize(mut self) -> Vec<u8> {
/*
rustfmt wanted to merge the lines together so had to use this
to stop this from occurring
*/
#[cfg_attr(rustfmt, rustfmt_skip)]
#[allow(deprecated)]
self.hasher.finish().unwrap()
self.hasher.finish().unwrap().to_vec()
}
}

Expand Down