@@ -5,7 +5,7 @@ use futures_lite::{future::Boxed, FutureExt};
55use hyper:: client:: HttpConnector ;
66use hyper:: header:: HeaderValue ;
77use hyper:: { body, body:: Buf , header, Body , Client , Method , Request , Response , Uri } ;
8- use hyper_rustls:: HttpsConnector ;
8+ use hyper_rustls:: { ConfigBuilderExt , HttpsConnector } ;
99use libflate:: gzip;
1010use log:: { error, trace, warn} ;
1111use percent_encoding:: { percent_encode, CONTROLS } ;
@@ -30,8 +30,36 @@ const REDDIT_SHORT_URL_BASE_HOST: &str = "redd.it";
3030const ALTERNATIVE_REDDIT_URL_BASE : & str = "https://www.reddit.com" ;
3131const ALTERNATIVE_REDDIT_URL_BASE_HOST : & str = "www.reddit.com" ;
3232
33- pub static HTTPS_CONNECTOR : LazyLock < HttpsConnector < HttpConnector > > =
34- LazyLock :: new ( || hyper_rustls:: HttpsConnectorBuilder :: new ( ) . with_native_roots ( ) . https_only ( ) . enable_http2 ( ) . build ( ) ) ;
33+ pub static HTTPS_CONNECTOR : LazyLock < HttpsConnector < HttpConnector > > = LazyLock :: new ( || {
34+ hyper_rustls:: HttpsConnectorBuilder :: new ( )
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+ )
59+ . https_only ( )
60+ . enable_http2 ( )
61+ . build ( )
62+ } ) ;
3563
3664pub static CLIENT : LazyLock < Client < HttpsConnector < HttpConnector > > > = LazyLock :: new ( || Client :: builder ( ) . build :: < _ , Body > ( HTTPS_CONNECTOR . clone ( ) ) ) ;
3765
0 commit comments