Skip to content
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

fix: Do not include user information in Host header #3621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions examples/client.rs
Expand Up @@ -53,12 +53,10 @@ async fn fetch_url(url: hyper::Uri) -> Result<()> {
}
});

let authority = url.authority().unwrap().clone();

let path = url.path();
let req = Request::builder()
.uri(path)
.header(hyper::header::HOST, authority.as_str())
.header(hyper::header::HOST, format!("{}:{}", host, port))
.body(Empty::<Bytes>::new())?;

let mut res = sender.send_request(req).await?;
Expand Down
6 changes: 2 additions & 4 deletions examples/client_json.rs
Expand Up @@ -42,12 +42,10 @@ async fn fetch_json(url: hyper::Uri) -> Result<Vec<User>> {
}
});

let authority = url.authority().unwrap().clone();

// Fetch the url...
// Fetch the URL...
let req = Request::builder()
.uri(url)
.header(hyper::header::HOST, authority.as_str())
.header(hyper::header::HOST, format!("{}:{}", host, port))
.body(Empty::<Bytes>::new())?;

let res = sender.send_request(req).await?;
Expand Down
8 changes: 2 additions & 6 deletions examples/single_threaded.rs
Expand Up @@ -181,13 +181,11 @@ async fn http1_client(url: hyper::Uri) -> Result<(), Box<dyn std::error::Error>>
}
});

let authority = url.authority().unwrap().clone();

// Make 4 requests
for _ in 0..4 {
let req = Request::builder()
.uri(url.clone())
.header(hyper::header::HOST, authority.as_str())
.header(hyper::header::HOST, format!("{}:{}", host, port))
.body(Body::from("test".to_string()))?;

let mut res = sender.send_request(req).await?;
Expand Down Expand Up @@ -282,13 +280,11 @@ async fn http2_client(url: hyper::Uri) -> Result<(), Box<dyn std::error::Error>>
}
});

let authority = url.authority().unwrap().clone();

// Make 4 requests
for _ in 0..4 {
let req = Request::builder()
.uri(url.clone())
.header(hyper::header::HOST, authority.as_str())
.header(hyper::header::HOST, format!("{}:{}", host, port))
.body(Body::from("test".to_string()))?;

let mut res = sender.send_request(req).await?;
Expand Down