mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
cleanup
This commit is contained in:
parent
d7e65b6212
commit
20af8822fd
18
src/info.rs
18
src/info.rs
@ -63,9 +63,7 @@ impl<'a> ConnectionInfo<'a> {
|
||||
}
|
||||
}
|
||||
if scheme.is_none() {
|
||||
if let Some(a) = req.uri().scheme_part() {
|
||||
scheme = Some(a.as_str())
|
||||
}
|
||||
scheme = req.uri().scheme_part().map(|a| a.as_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,14 +76,10 @@ impl<'a> ConnectionInfo<'a> {
|
||||
}
|
||||
if host.is_none() {
|
||||
if let Some(h) = req.headers().get(header::HOST) {
|
||||
if let Ok(h) = h.to_str() {
|
||||
host = Some(h);
|
||||
}
|
||||
host = h.to_str().ok();
|
||||
}
|
||||
if host.is_none() {
|
||||
if let Some(a) = req.uri().authority_part() {
|
||||
host = Some(a.as_str())
|
||||
}
|
||||
host = req.uri().authority_part().map(|a| a.as_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,10 +93,8 @@ impl<'a> ConnectionInfo<'a> {
|
||||
}
|
||||
}
|
||||
if remote.is_none() {
|
||||
if let Some(addr) = req.peer_addr() {
|
||||
// get peeraddr from socketaddr
|
||||
peer = Some(format!("{}", addr));
|
||||
}
|
||||
// get peeraddr from socketaddr
|
||||
peer = req.peer_addr().map(|addr| format!("{}", addr));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user