Moved follow-trusted as a feature.
This commit is contained in:
@@ -29,6 +29,7 @@ default = ["async"]
|
||||
async = ["futures-util", "async-stream", "reqwest/stream"]
|
||||
websockets = ["tokio", "tokio-tungstenite"]
|
||||
blocking = ["reqwest/blocking"]
|
||||
follow-trusted = []
|
||||
debug = []
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -149,8 +149,16 @@ impl ClientBuilder {
|
||||
if attempt.previous().len() > 5 {
|
||||
attempt.error("Too many redirects.")
|
||||
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts_.contains(host) )
|
||||
{
|
||||
#[cfg(feature = "follow-trusted")]
|
||||
{
|
||||
attempt.follow_trusted()
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "follow-trusted"))]
|
||||
{
|
||||
attempt.follow()
|
||||
}
|
||||
} else {
|
||||
let message = format!(
|
||||
"Aborting redirect request to unknown host '{}'.",
|
||||
@@ -327,8 +335,16 @@ impl Client {
|
||||
if attempt.previous().len() > 5 {
|
||||
attempt.error("Too many redirects.")
|
||||
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts.contains(host) )
|
||||
{
|
||||
#[cfg(feature = "follow-trusted")]
|
||||
{
|
||||
attempt.follow_trusted()
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "follow-trusted"))]
|
||||
{
|
||||
attempt.follow()
|
||||
}
|
||||
} else {
|
||||
let message = format!(
|
||||
"Aborting redirect request to unknown host '{}'.",
|
||||
|
||||
Reference in New Issue
Block a user