@@ -4,7 +4,7 @@ use futures_lite::future::block_on;
44use futures_lite:: { future:: Boxed , FutureExt } ;
55use hyper:: header:: HeaderValue ;
66use hyper:: { body, body:: Buf , header, Body , Client , Method , Request , Response , Uri } ;
7- use hyper_rustls:: HttpsConnector ;
7+ use hyper_rustls:: { ConfigBuilderExt , HttpsConnector } ;
88use libflate:: gzip;
99use log:: { error, trace, warn} ;
1010use once_cell:: sync:: Lazy ;
@@ -32,7 +32,30 @@ const ALTERNATIVE_REDDIT_URL_BASE_HOST: &str = "www.reddit.com";
3232pub static HTTPS_CONNECTOR : Lazy < HttpsConnector < ProxyConnector > > = Lazy :: new ( || {
3333 let proxy_connector = ProxyConnector :: new ( ) ;
3434 hyper_rustls:: HttpsConnectorBuilder :: new ( )
35- . with_native_roots ( )
35+ . with_tls_config (
36+ rustls:: ClientConfig :: builder ( )
37+ // These are the Firefox 145.0 cipher suite,
38+ // minus the suites missing forward-secrecy support,
39+ // in the same order.
40+ // https://github.com/redlib-org/redlib/issues/446#issuecomment-3609306592
41+ . with_cipher_suites ( & [
42+ rustls:: cipher_suite:: TLS13_AES_256_GCM_SHA384 ,
43+ rustls:: cipher_suite:: TLS13_AES_128_GCM_SHA256 ,
44+ rustls:: cipher_suite:: TLS13_CHACHA20_POLY1305_SHA256 ,
45+ rustls:: cipher_suite:: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
46+ rustls:: cipher_suite:: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
47+ rustls:: cipher_suite:: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 ,
48+ rustls:: cipher_suite:: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 ,
49+ rustls:: cipher_suite:: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
50+ rustls:: cipher_suite:: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
51+ ] )
52+ // .with_safe_default_cipher_suites()
53+ . with_safe_default_kx_groups ( )
54+ . with_safe_default_protocol_versions ( )
55+ . unwrap ( )
56+ . with_native_roots ( )
57+ . with_no_client_auth ( ) ,
58+ )
3659 . https_only ( )
3760 . enable_http2 ( )
3861 . wrap_connector ( proxy_connector)
@@ -512,9 +535,9 @@ pub async fn rate_limit_check() -> Result<(), String> {
512535 Ok ( ( ) )
513536}
514537
538+ use crate :: proxy:: ProxyConnector ;
515539#[ cfg( test) ]
516540use { crate :: config:: get_setting, sealed_test:: prelude:: * } ;
517- use crate :: proxy:: ProxyConnector ;
518541
519542#[ tokio:: test( flavor = "multi_thread" ) ]
520543async fn test_rate_limit_check ( ) {
0 commit comments