diff --git a/awc/CHANGES.md b/awc/CHANGES.md
index d3fd7147..83709e8c 100644
--- a/awc/CHANGES.md
+++ b/awc/CHANGES.md
@@ -8,6 +8,7 @@
- Do not send `Host` header on HTTP/2 requests, as it is not required, and some web servers may reject it.
- Update `brotli` dependency to `7`.
- Minimum supported Rust version (MSRV) is now 1.75.
+- Replace `trust-dns-resolver` with `hickory-resolver` for DNS resolution in awc when using `trust-dns` feature.
## 3.5.1
diff --git a/awc/Cargo.toml b/awc/Cargo.toml
index 94eebcbc..3677183f 100644
--- a/awc/Cargo.toml
+++ b/awc/Cargo.toml
@@ -83,8 +83,10 @@ compress-zstd = ["actix-http/compress-zstd", "__compress"]
# Cookie parsing and cookie jar
cookies = ["dep:cookie"]
-# Use `trust-dns-resolver` crate as DNS resolver
-trust-dns = ["trust-dns-resolver"]
+# Use `trust-dns-resolver` crate as DNS resolver, deprecated in favor of `hickory-dns` which is a drop-in replacement
+trust-dns = ["hickory-dns"]
+# Use `hickory-dns-resolver` crate as DNS resolver
+hickory-dns = ["hickory-resolver"]
# Internal (PRIVATE!) features used to aid testing and checking feature status.
# Don't rely on these whatsoever. They may disappear at anytime.
@@ -130,7 +132,7 @@ tls-rustls-0_21 = { package = "rustls", version = "0.21", optional = true, featu
tls-rustls-0_22 = { package = "rustls", version = "0.22", optional = true }
tls-rustls-0_23 = { package = "rustls", version = "0.23", optional = true, default-features = false }
-trust-dns-resolver = { version = "0.23", optional = true }
+hickory-resolver = { version = "0.24.2", optional = true }
[dev-dependencies]
actix-http = { version = "3.7", features = ["openssl"] }
diff --git a/awc/src/client/connector.rs b/awc/src/client/connector.rs
index a7c60682..5f952ea5 100644
--- a/awc/src/client/connector.rs
+++ b/awc/src/client/connector.rs
@@ -1037,7 +1037,7 @@ where
}
}
-#[cfg(not(feature = "trust-dns"))]
+#[cfg(not(feature = "hickory-dns"))]
mod resolver {
use super::*;
@@ -1046,12 +1046,12 @@ mod resolver {
}
}
-#[cfg(feature = "trust-dns")]
+#[cfg(feature = "hickory-dns")]
mod resolver {
use std::{cell::RefCell, net::SocketAddr};
use actix_tls::connect::Resolve;
- use trust_dns_resolver::{
+ use hickory_resolver::{
config::{ResolverConfig, ResolverOpts},
system_conf::read_system_conf,
TokioAsyncResolver,
@@ -1061,9 +1061,9 @@ mod resolver {
pub(super) fn resolver() -> Resolver {
// new type for impl Resolve trait for TokioAsyncResolver.
- struct TrustDnsResolver(TokioAsyncResolver);
+ struct HickoryDnsResolver(TokioAsyncResolver);
- impl Resolve for TrustDnsResolver {
+ impl Resolve for HickoryDnsResolver {
fn lookup<'a>(
&'a self,
host: &'a str,
@@ -1085,11 +1085,11 @@ mod resolver {
// resolver struct is cached in thread local so new clients can reuse the existing instance
thread_local! {
- static TRUST_DNS_RESOLVER: RefCell