diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 89879da68d..17367af548 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -699,9 +699,8 @@ where let unsafely_ignore_certificate_errors = state .borrow() - .borrow::() - .0 - .clone(); + .try_borrow::() + .and_then(|it| it.0.clone()); // TODO(@justinmchase): Ideally the certificate store is created once // and not cloned. The store should be wrapped in Arc to reduce @@ -768,9 +767,8 @@ where let cert_file = args.cert_file.as_deref(); let unsafely_ignore_certificate_errors = state .borrow() - .borrow::() - .0 - .clone(); + .try_borrow::() + .and_then(|it| it.0.clone()); if args.cert_chain.is_some() { super::check_unstable2(&state, "ConnectTlsOptions.certChain"); diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index c75fa17420..f9f11e591f 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -224,9 +224,8 @@ where let unsafely_ignore_certificate_errors = state .borrow() - .borrow::() - .0 - .clone(); + .try_borrow::() + .and_then(|it| it.0.clone()); let root_cert_store = state.borrow().borrow::().0.clone(); let user_agent = state.borrow().borrow::().0.clone(); let uri: Uri = args.url.parse()?;