Skip to content

Commit

Permalink
Upgrade dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and seanmonstar committed Feb 11, 2022
1 parent 47e9f62 commit 4c31a32
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 124 deletions.
16 changes: 7 additions & 9 deletions Cargo.toml
Expand Up @@ -55,22 +55,20 @@ indexmap = { version = "1.5.2", features = ["std"] }
[dev-dependencies]

# Fuzzing
quickcheck = { version = "0.4.1", default-features = false }
rand = "0.3.15"
quickcheck = { version = "1.0.3", default-features = false }
rand = "0.8.4"

# HPACK fixtures
hex = "0.2.0"
walkdir = "1.0.0"
hex = "0.4.3"
walkdir = "2.3.2"
serde = "1.0.0"
serde_json = "1.0.0"

# Examples
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "net"] }
env_logger = { version = "0.5.3", default-features = false }
rustls = "0.19"
tokio-rustls = "0.22"
webpki = "0.21"
webpki-roots = "0.21"
env_logger = { version = "0.9", default-features = false }
tokio-rustls = "0.23.2"
webpki-roots = "0.22.2"

[package.metadata.docs.rs]
features = ["stream"]
24 changes: 17 additions & 7 deletions examples/akamai.rs
Expand Up @@ -3,9 +3,9 @@ use http::{Method, Request};
use tokio::net::TcpStream;
use tokio_rustls::TlsConnector;

use rustls::Session;
use webpki::DNSNameRef;
use tokio_rustls::rustls::{OwnedTrustAnchor, RootCertStore, ServerName};

use std::convert::TryFrom;
use std::error::Error;
use std::net::ToSocketAddrs;

Expand All @@ -16,9 +16,19 @@ pub async fn main() -> Result<(), Box<dyn Error>> {
let _ = env_logger::try_init();

let tls_client_config = std::sync::Arc::new({
let mut c = rustls::ClientConfig::new();
c.root_store
.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
let mut root_store = RootCertStore::empty();
root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
OwnedTrustAnchor::from_subject_spki_name_constraints(
ta.subject,
ta.spki,
ta.name_constraints,
)
}));

let mut c = tokio_rustls::rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(root_store)
.with_no_client_auth();
c.alpn_protocols.push(ALPN_H2.as_bytes().to_owned());
c
});
Expand All @@ -33,13 +43,13 @@ pub async fn main() -> Result<(), Box<dyn Error>> {
println!("ADDR: {:?}", addr);

let tcp = TcpStream::connect(&addr).await?;
let dns_name = DNSNameRef::try_from_ascii_str("http2.akamai.com").unwrap();
let dns_name = ServerName::try_from("http2.akamai.com").unwrap();
let connector = TlsConnector::from(tls_client_config);
let res = connector.connect(dns_name, tcp).await;
let tls = res.unwrap();
{
let (_, session) = tls.get_ref();
let negotiated_protocol = session.get_alpn_protocol();
let negotiated_protocol = session.alpn_protocol();
assert_eq!(
Some(ALPN_H2.as_bytes()),
negotiated_protocol.as_ref().map(|x| &**x)
Expand Down
2 changes: 0 additions & 2 deletions fuzz/Cargo.toml
Expand Up @@ -13,12 +13,10 @@ cargo-fuzz = true
arbitrary = { version = "1", features = ["derive"] }
libfuzzer-sys = { version = "0.4.0", features = ["arbitrary-derive"] }
tokio = { version = "1", features = [ "full" ] }
bytes = "0.5.2"
h2 = { path = "../", features = [ "unstable" ] }
h2-support = { path = "../tests/h2-support" }
futures = { version = "0.3", default-features = false, features = ["std"] }
http = "0.2"
env_logger = { version = "0.5.3", default-features = false }

# Prevent this from interfering with workspaces
[workspace]
Expand Down
2 changes: 1 addition & 1 deletion src/fuzz_bridge.rs
@@ -1,7 +1,7 @@
#[cfg(fuzzing)]
pub mod fuzz_logic {
use crate::hpack;
use bytes::{BufMut, BytesMut};
use bytes::BytesMut;
use http::header::HeaderName;
use std::io::Cursor;

Expand Down

0 comments on commit 4c31a32

Please sign in to comment.