mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 17:07:01 +02:00
rustfmt 0.7
This commit is contained in:
15
src/info.rs
15
src/info.rs
@@ -53,7 +53,8 @@ impl<'a> ConnectionInfo<'a> {
|
||||
|
||||
// scheme
|
||||
if scheme.is_none() {
|
||||
if let Some(h) = req.headers()
|
||||
if let Some(h) = req
|
||||
.headers()
|
||||
.get(HeaderName::from_str(X_FORWARDED_PROTO).unwrap())
|
||||
{
|
||||
if let Ok(h) = h.to_str() {
|
||||
@@ -74,7 +75,8 @@ impl<'a> ConnectionInfo<'a> {
|
||||
|
||||
// host
|
||||
if host.is_none() {
|
||||
if let Some(h) = req.headers()
|
||||
if let Some(h) = req
|
||||
.headers()
|
||||
.get(HeaderName::from_str(X_FORWARDED_HOST).unwrap())
|
||||
{
|
||||
if let Ok(h) = h.to_str() {
|
||||
@@ -98,7 +100,8 @@ impl<'a> ConnectionInfo<'a> {
|
||||
|
||||
// remote addr
|
||||
if remote.is_none() {
|
||||
if let Some(h) = req.headers()
|
||||
if let Some(h) = req
|
||||
.headers()
|
||||
.get(HeaderName::from_str(X_FORWARDED_FOR).unwrap())
|
||||
{
|
||||
if let Ok(h) = h.to_str() {
|
||||
@@ -189,10 +192,8 @@ mod tests {
|
||||
assert_eq!(info.remote(), Some("192.0.2.60"));
|
||||
|
||||
let mut req = HttpRequest::default();
|
||||
req.headers_mut().insert(
|
||||
header::HOST,
|
||||
HeaderValue::from_static("rust-lang.org"),
|
||||
);
|
||||
req.headers_mut()
|
||||
.insert(header::HOST, HeaderValue::from_static("rust-lang.org"));
|
||||
|
||||
let info = ConnectionInfo::new(&req);
|
||||
assert_eq!(info.scheme(), "http");
|
||||
|
Reference in New Issue
Block a user