@@ -819,12 +819,12 @@ impl Bucket {
819819 ///
820820 /// # fn example() -> Result<(), S3Error> {
821821 /// let bucket = Bucket::new("my-bucket", Region::from_str("us-east-1")?, Credentials::default()?)?
822- /// .set_dangereous_config (true, true)?;
822+ /// .set_dangerous_config (true, true)?;
823823 /// # Ok(())
824824 /// # }
825- ///
825+ /// ```
826826 #[ cfg( any( feature = "tokio-native-tls" , feature = "tokio-rustls-tls" ) ) ]
827- pub fn set_dangereous_config (
827+ pub fn set_dangerous_config (
828828 & self ,
829829 accept_invalid_certs : bool ,
830830 accept_invalid_hostnames : bool ,
@@ -847,6 +847,20 @@ impl Bucket {
847847 } )
848848 }
849849
850+ /// Deprecated alias for [`Bucket::set_dangerous_config`].
851+ #[ deprecated(
852+ since = "0.37.3" ,
853+ note = "use `set_dangerous_config`; this misspelled method remains for compatibility"
854+ ) ]
855+ #[ cfg( any( feature = "tokio-native-tls" , feature = "tokio-rustls-tls" ) ) ]
856+ pub fn set_dangereous_config (
857+ & self ,
858+ accept_invalid_certs : bool ,
859+ accept_invalid_hostnames : bool ,
860+ ) -> Result < Bucket , S3Error > {
861+ self . set_dangerous_config ( accept_invalid_certs, accept_invalid_hostnames)
862+ }
863+
850864 #[ cfg( feature = "with-tokio" ) ]
851865 pub fn set_proxy ( & self , proxy : reqwest:: Proxy ) -> Result < Bucket , S3Error > {
852866 let mut options = self . client_options . clone ( ) ;
@@ -3173,6 +3187,34 @@ mod test {
31733187 assert_eq ! ( requests. load( Ordering :: SeqCst ) , 1 ) ;
31743188 }
31753189
3190+ #[ test]
3191+ #[ cfg( any( feature = "tokio-native-tls" , feature = "tokio-rustls-tls" ) ) ]
3192+ #[ allow( deprecated) ]
3193+ fn dangerous_config_correct_spelling_and_compat_alias_set_same_options ( ) {
3194+ let bucket = Bucket :: new (
3195+ "test-bucket" ,
3196+ Region :: Custom {
3197+ region : "test-region" . to_owned ( ) ,
3198+ endpoint : "https://example.com" . to_owned ( ) ,
3199+ } ,
3200+ Credentials :: anonymous ( ) . unwrap ( ) ,
3201+ )
3202+ . unwrap ( ) ;
3203+
3204+ let corrected = bucket. set_dangerous_config ( true , true ) . unwrap ( ) ;
3205+ let deprecated_alias = bucket. set_dangereous_config ( true , true ) . unwrap ( ) ;
3206+
3207+ assert ! ( corrected. client_options. accept_invalid_certs) ;
3208+ assert ! ( corrected. client_options. accept_invalid_hostnames) ;
3209+ assert_eq ! (
3210+ corrected. client_options. accept_invalid_certs,
3211+ deprecated_alias. client_options. accept_invalid_certs
3212+ ) ;
3213+ assert_eq ! (
3214+ corrected. client_options. accept_invalid_hostnames,
3215+ deprecated_alias. client_options. accept_invalid_hostnames
3216+ ) ;
3217+ }
31763218 fn test_aws_credentials ( ) -> Credentials {
31773219 Credentials :: new (
31783220 Some ( & env:: var ( "EU_AWS_ACCESS_KEY_ID" ) . unwrap ( ) ) ,
@@ -4398,7 +4440,7 @@ mod test {
43984440 . with_path_style ( ) ;
43994441
44004442 // Set dangerous config (allow invalid certs, allow invalid hostnames)
4401- let bucket = bucket. set_dangereous_config ( true , true ) . unwrap ( ) ;
4443+ let bucket = bucket. set_dangerous_config ( true , true ) . unwrap ( ) ;
44024444
44034445 // Test that exists() works with the dangerous config
44044446 // This should not panic or fail due to SSL certificate issues
0 commit comments