1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

tests for default predicates

This commit is contained in:
Nikolay Kim
2017-12-08 12:51:44 -08:00
parent 3e91b06241
commit 9043e7286d
3 changed files with 106 additions and 11 deletions

View File

@@ -65,7 +65,7 @@ impl<'a> ConnectionInfo<'a> {
if scheme.is_none() {
scheme = req.uri().scheme_part().map(|a| a.as_str());
if scheme.is_none() {
if let Some(ref router) = req.router() {
if let Some(router) = req.router() {
if router.server_settings().secure() {
scheme = Some("https")
}
@@ -88,7 +88,7 @@ impl<'a> ConnectionInfo<'a> {
if host.is_none() {
host = req.uri().authority_part().map(|a| a.as_str());
if host.is_none() {
if let Some(ref router) = req.router() {
if let Some(router) = req.router() {
host = Some(router.server_settings().host());
}
}
@@ -104,8 +104,7 @@ impl<'a> ConnectionInfo<'a> {
remote = h.split(',').next().map(|v| v.trim());
}
}
if remote.is_none() {
// get peeraddr from socketaddr
if remote.is_none() { // get peeraddr from socketaddr
peer = req.peer_addr().map(|addr| format!("{}", addr));
}
}