Use rustfmt to enforce consistent formatting
This change adds a .rustfmt.toml that includes ALL supported settings, 12 of which we have overridden to attempt to cater to our own proclivities. rustfmt is checked in the rust-nightly CI job.
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
extern crate h2;
|
||||
extern crate http;
|
||||
extern crate futures;
|
||||
extern crate io_dump;
|
||||
extern crate rustls;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_rustls;
|
||||
extern crate webpki_roots;
|
||||
extern crate io_dump;
|
||||
extern crate env_logger;
|
||||
|
||||
use h2::client::Client;
|
||||
|
||||
use http::{Request, Method};
|
||||
use futures::*;
|
||||
use http::{Method, Request};
|
||||
|
||||
use tokio_core::reactor;
|
||||
use tokio_core::net::TcpStream;
|
||||
use tokio_core::reactor;
|
||||
|
||||
use rustls::Session;
|
||||
use tokio_rustls::ClientConfigExt;
|
||||
@@ -27,26 +27,30 @@ pub fn main() {
|
||||
let _ = env_logger::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);
|
||||
c.alpn_protocols.push(ALPN_H2.to_owned());
|
||||
c
|
||||
});
|
||||
let mut c = rustls::ClientConfig::new();
|
||||
c.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
|
||||
c.alpn_protocols.push(ALPN_H2.to_owned());
|
||||
c
|
||||
});
|
||||
|
||||
// Sync DNS resolution.
|
||||
let addr = "http2.akamai.com:443".to_socket_addrs()
|
||||
.unwrap().next().unwrap();
|
||||
let addr = "http2.akamai.com:443"
|
||||
.to_socket_addrs()
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap();
|
||||
|
||||
println!("ADDR: {:?}", addr);
|
||||
|
||||
let mut core = reactor::Core::new().unwrap();;
|
||||
let mut core = reactor::Core::new().unwrap();
|
||||
let handle = core.handle();
|
||||
|
||||
let tcp = TcpStream::connect(&addr, &handle);
|
||||
|
||||
let tcp = tcp.then(|res| {
|
||||
let tcp = res.unwrap();
|
||||
tls_client_config.connect_async("http2.akamai.com", tcp)
|
||||
tls_client_config
|
||||
.connect_async("http2.akamai.com", tcp)
|
||||
.then(|res| {
|
||||
let tls = res.unwrap();
|
||||
let negotiated_protcol = {
|
||||
@@ -67,7 +71,8 @@ pub fn main() {
|
||||
let request = Request::builder()
|
||||
.method(Method::GET)
|
||||
.uri("https://http2.akamai.com/")
|
||||
.body(()).unwrap();
|
||||
.body(())
|
||||
.unwrap();
|
||||
|
||||
let stream = h2.request(request, true).unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user