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:
14
src/info.rs
14
src/info.rs
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user