Moved follow-trusted as a feature.
parent
15624137be
commit
24c5e61cf3
|
@ -29,6 +29,7 @@ default = ["async"]
|
||||||
async = ["futures-util", "async-stream", "reqwest/stream"]
|
async = ["futures-util", "async-stream", "reqwest/stream"]
|
||||||
websockets = ["tokio", "tokio-tungstenite"]
|
websockets = ["tokio", "tokio-tungstenite"]
|
||||||
blocking = ["reqwest/blocking"]
|
blocking = ["reqwest/blocking"]
|
||||||
|
follow-trusted = []
|
||||||
debug = []
|
debug = []
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -150,7 +150,15 @@ impl ClientBuilder {
|
||||||
attempt.error("Too many redirects.")
|
attempt.error("Too many redirects.")
|
||||||
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts_.contains(host) )
|
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts_.contains(host) )
|
||||||
{
|
{
|
||||||
attempt.follow_trusted()
|
#[cfg(feature = "follow-trusted")]
|
||||||
|
{
|
||||||
|
attempt.follow_trusted()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "follow-trusted"))]
|
||||||
|
{
|
||||||
|
attempt.follow()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let message = format!(
|
let message = format!(
|
||||||
"Aborting redirect request to unknown host '{}'.",
|
"Aborting redirect request to unknown host '{}'.",
|
||||||
|
@ -328,7 +336,15 @@ impl Client {
|
||||||
attempt.error("Too many redirects.")
|
attempt.error("Too many redirects.")
|
||||||
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts.contains(host) )
|
} else if matches!( attempt.url().host_str(), Some(host) if trusted_hosts.contains(host) )
|
||||||
{
|
{
|
||||||
attempt.follow_trusted()
|
#[cfg(feature = "follow-trusted")]
|
||||||
|
{
|
||||||
|
attempt.follow_trusted()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "follow-trusted"))]
|
||||||
|
{
|
||||||
|
attempt.follow()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let message = format!(
|
let message = format!(
|
||||||
"Aborting redirect request to unknown host '{}'.",
|
"Aborting redirect request to unknown host '{}'.",
|
||||||
|
|
Loading…
Reference in New Issue