diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs index d59ba9270..c5289a357 100644 --- a/src/admin/debug/commands.rs +++ b/src/admin/debug/commands.rs @@ -1014,7 +1014,7 @@ impl crate::Context<'_> { let resolver: &MatrixResolver = if no_cache { &MatrixResolverBuilder::new() .dangerous_tls_accept_invalid_certs(self.services.server.config.allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure) - .http_client(self.services.client.well_known.clone()) + .http_client(self.services.client.default.clone()) .build()? } else { &self.services.resolver.resolver diff --git a/src/service/client/mod.rs b/src/service/client/mod.rs index 4a299fee3..5c3ca642a 100644 --- a/src/service/client/mod.rs +++ b/src/service/client/mod.rs @@ -11,7 +11,6 @@ pub struct Service { pub default: reqwest::Client, pub url_preview: reqwest::Client, pub extern_media: reqwest::Client, - pub well_known: reqwest::Client, pub federation: reqwest::Client, pub federation_slow: reqwest::Client, pub sender: reqwest::Client, @@ -62,15 +61,6 @@ impl crate::Service for Service { .redirect(redirect::Policy::limited(3)) .build()?, - well_known: base(config)? - .dns_resolver(resolver.dns.resolver.clone()) - .connect_timeout(Duration::from_secs(config.well_known_conn_timeout)) - .read_timeout(Duration::from_secs(config.well_known_timeout)) - .timeout(Duration::from_secs(config.well_known_timeout)) - .pool_max_idle_per_host(0) - .redirect(redirect::Policy::limited(4)) - .build()?, - federation: base(config)? .dns_resolver(resolver.dns.resolver.hooked.clone()) .connect_timeout(Duration::from_secs(config.federation_conn_timeout)) @@ -151,7 +141,7 @@ impl Service { } } -fn base(config: &Config) -> Result { +pub fn base(config: &Config) -> Result { let mut builder = reqwest::Client::builder() .hickory_dns(true) .connect_timeout(Duration::from_secs(config.request_conn_timeout)) diff --git a/src/service/resolver/mod.rs b/src/service/resolver/mod.rs index f9033ca06..c0e5c0da5 100644 --- a/src/service/resolver/mod.rs +++ b/src/service/resolver/mod.rs @@ -2,14 +2,15 @@ pub mod cache; mod dns; pub mod fed; -use std::sync::Arc; +use std::{sync::Arc, time::Duration}; use async_trait::async_trait; use conduwuit::Result; +use reqwest::redirect; use resolvematrix::server::{MatrixResolver, MatrixResolverBuilder}; use self::{cache::Cache, dns::Resolver}; -use crate::client; +use crate::client::base; pub struct Service { pub resolver: MatrixResolver, @@ -34,7 +35,15 @@ impl crate::Service for Service { Ok(Arc::new(Self { resolver: MatrixResolverBuilder::new() .dangerous_tls_accept_invalid_certs(args.server.config.allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure) - .http_client(args.depend::("client").well_known.clone()) + .http_client( + base(&args.server.config)? + .connect_timeout(Duration::from_secs(args.server.config.well_known_conn_timeout)) + .read_timeout(Duration::from_secs(args.server.config.well_known_timeout)) + .timeout(Duration::from_secs(args.server.config.well_known_timeout)) + .pool_max_idle_per_host(0) + .redirect(redirect::Policy::limited(4)) + .build()? + ) .dns_resolver(resolver.resolver.clone()) .build()?, dns: Dns {