diff --git a/examples/http_proxy.rs b/examples/http_proxy.rs index acdd3127f6..58712b0f27 100644 --- a/examples/http_proxy.rs +++ b/examples/http_proxy.rs @@ -4,8 +4,6 @@ use std::net::SocketAddr; use bytes::Bytes; use http_body_util::{combinators::BoxBody, BodyExt, Empty, Full}; -use hyper::client::conn::http1::Builder; -use hyper::server::conn::http1; use hyper::service::service_fn; use hyper::upgrade::Upgraded; use hyper::{Method, Request, Response}; @@ -16,6 +14,9 @@ use tokio::net::{TcpListener, TcpStream}; mod support; use support::TokioIo; +type ClientBuilder = hyper::client::conn::http1::Builder; +type ServerBuilder = hyper::server::conn::http1::Builder; + // To try this example: // 1. cargo run --example http_proxy // 2. config http_proxy in command line @@ -35,7 +36,7 @@ async fn main() -> Result<(), Box> { let io = TokioIo::new(stream); tokio::task::spawn(async move { - if let Err(err) = http1::Builder::new() + if let Err(err) = ServerBuilder::new() .preserve_header_case(true) .title_case_headers(true) .serve_connection(io, service_fn(proxy)) @@ -94,7 +95,7 @@ async fn proxy( let stream = TcpStream::connect((host, port)).await.unwrap(); let io = TokioIo::new(stream); - let (mut sender, conn) = Builder::new() + let (mut sender, conn) = ClientBuilder::new() .preserve_header_case(true) .title_case_headers(true) .handshake(io)