Skip to content

Commit

Permalink
Extract remote host address from authority, then from header
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-sinyapkin committed Aug 15, 2024
1 parent 7bae544 commit e3e98ee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/handlers/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ mod utils {
};

pub fn get_host_addr(req: &mut Request<body::Incoming>) -> Option<Address> {
if req.uri().authority().is_some() {
get_host_addr_from_authority(req)
} else {
get_host_addr_from_header(req)
match get_host_addr_from_authority(req) {
Some(addr) => Some(addr),
None => get_host_addr_from_header(req),
}
}

Expand Down

0 comments on commit e3e98ee

Please sign in to comment.