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

use server settings for scheme and host values

This commit is contained in:
Nikolay Kim
2017-12-08 09:48:53 -08:00
parent 1293619096
commit 774bfc0a86
4 changed files with 47 additions and 9 deletions

View File

@@ -64,6 +64,13 @@ 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 router.server_settings().secure() {
scheme = Some("https")
}
}
}
}
}
@@ -79,7 +86,12 @@ impl<'a> ConnectionInfo<'a> {
host = h.to_str().ok();
}
if host.is_none() {
host = req.uri().authority_part().map(|a| a.as_str())
host = req.uri().authority_part().map(|a| a.as_str());
if host.is_none() {
if let Some(ref router) = req.router() {
host = Some(router.server_settings().host());
}
}
}
}
}