@@ -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 ( ) ;
@@ -3118,6 +3132,34 @@ mod test {
31183132 let _ = env_logger:: builder ( ) . is_test ( true ) . try_init ( ) ;
31193133 }
31203134
3135+ #[ test]
3136+ #[ cfg( any( feature = "tokio-native-tls" , feature = "tokio-rustls-tls" ) ) ]
3137+ #[ allow( deprecated) ]
3138+ fn dangerous_config_correct_spelling_and_compat_alias_set_same_options ( ) {
3139+ let bucket = Bucket :: new (
3140+ "test-bucket" ,
3141+ Region :: Custom {
3142+ region : "test-region" . to_owned ( ) ,
3143+ endpoint : "https://example.com" . to_owned ( ) ,
3144+ } ,
3145+ Credentials :: anonymous ( ) . unwrap ( ) ,
3146+ )
3147+ . unwrap ( ) ;
3148+
3149+ let corrected = bucket. set_dangerous_config ( true , true ) . unwrap ( ) ;
3150+ let deprecated_alias = bucket. set_dangereous_config ( true , true ) . unwrap ( ) ;
3151+
3152+ assert ! ( corrected. client_options. accept_invalid_certs) ;
3153+ assert ! ( corrected. client_options. accept_invalid_hostnames) ;
3154+ assert_eq ! (
3155+ corrected. client_options. accept_invalid_certs,
3156+ deprecated_alias. client_options. accept_invalid_certs
3157+ ) ;
3158+ assert_eq ! (
3159+ corrected. client_options. accept_invalid_hostnames,
3160+ deprecated_alias. client_options. accept_invalid_hostnames
3161+ ) ;
3162+ }
31213163 fn test_aws_credentials ( ) -> Credentials {
31223164 Credentials :: new (
31233165 Some ( & env:: var ( "EU_AWS_ACCESS_KEY_ID" ) . unwrap ( ) ) ,
@@ -4321,7 +4363,7 @@ mod test {
43214363 . with_path_style ( ) ;
43224364
43234365 // Set dangerous config (allow invalid certs, allow invalid hostnames)
4324- let bucket = bucket. set_dangereous_config ( true , true ) . unwrap ( ) ;
4366+ let bucket = bucket. set_dangerous_config ( true , true ) . unwrap ( ) ;
43254367
43264368 // Test that exists() works with the dangerous config
43274369 // This should not panic or fail due to SSL certificate issues
0 commit comments