mirror of https://github.com/fafhrd91/actix-web
supports origin-relative redirects
This commit is contained in:
parent
d16d1de93f
commit
199f6af1e1
|
@ -118,6 +118,7 @@ where
|
||||||
Body::Message(_) => Body::Empty,
|
Body::Message(_) => Body::Empty,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let uri = head.uri.clone();
|
||||||
let mut reqhead = RequestHead::default();
|
let mut reqhead = RequestHead::default();
|
||||||
reqhead.method = head.method.clone();
|
reqhead.method = head.method.clone();
|
||||||
reqhead.version = head.version.clone();
|
reqhead.version = head.version.clone();
|
||||||
|
@ -144,7 +145,12 @@ where
|
||||||
reqhead.method = actix_http::http::Method::GET;
|
reqhead.method = actix_http::http::Method::GET;
|
||||||
reqbody = Body::None;
|
reqbody = Body::None;
|
||||||
}
|
}
|
||||||
reqhead.uri = location_uri;
|
let mut parts = location_uri.clone().into_parts();
|
||||||
|
if location_uri.authority().is_none() {
|
||||||
|
parts.scheme = Some(uri.scheme().unwrap().clone());
|
||||||
|
parts.authority = Some(uri.authority().unwrap().clone());
|
||||||
|
}
|
||||||
|
reqhead.uri = Uri::from_parts(parts).unwrap();
|
||||||
return deal_with_redirects(
|
return deal_with_redirects(
|
||||||
backend.clone(),
|
backend.clone(),
|
||||||
reqhead,
|
reqhead,
|
||||||
|
|
Loading…
Reference in New Issue