WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit abf696a

Browse files
authored
docs(example): Update http_proxy example to use (host, port) (#3434)
1 parent ea8dffe commit abf696a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/http_proxy.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ async fn proxy(
9090
} else {
9191
let host = req.uri().host().expect("uri has no host");
9292
let port = req.uri().port_u16().unwrap_or(80);
93-
let addr = format!("{}:{}", host, port);
9493

95-
let stream = TcpStream::connect(addr).await.unwrap();
94+
let stream = TcpStream::connect((host, port)).await.unwrap();
9695
let io = TokioIo::new(stream);
9796

9897
let (mut sender, conn) = Builder::new()

0 commit comments

Comments
 (0)