Box<dyn ReadWrite> for TlsConnector::connect

This commit is contained in:
Martin Algesten
2022-04-30 12:50:08 +02:00
parent 101467f13f
commit 65371c966c
6 changed files with 90 additions and 51 deletions

View File

@@ -356,7 +356,6 @@ pub(crate) fn default_tls_config() -> std::sync::Arc<dyn TlsConnector> {
// calls at the top of the crate (`ureq::get` etc).
#[cfg(not(feature = "tls"))]
pub(crate) fn default_tls_config() -> std::sync::Arc<dyn TlsConnector> {
use std::net::TcpStream;
use std::sync::Arc;
struct NoTlsConfig;
@@ -365,7 +364,7 @@ pub(crate) fn default_tls_config() -> std::sync::Arc<dyn TlsConnector> {
fn connect(
&self,
_dns_name: &str,
_tcp_stream: TcpStream,
_io: Box<dyn ReadWrite>,
) -> Result<Box<dyn ReadWrite>, crate::error::Error> {
Err(ErrorKind::UnknownScheme
.msg("cannot make HTTPS request because no TLS backend is configured"))