]> git.proxmox.com Git - proxmox-backup.git/commitdiff
HttpsConnector: use hostname instead of URL again
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 3 Feb 2021 14:09:19 +0000 (15:09 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 3 Feb 2021 14:18:18 +0000 (15:18 +0100)
fixes connecting to hosts with valid certificates without a
pinned fingerprint
this was accidentally changed in the tokio-1.0 updates
apparently

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: 0f860f712f86 ("tokio 1.0: update to new tokio-openssl interface")
src/tools/http.rs

index 0fbc85fbddd88a83cadfa3bc0c17bbeaa22921a1..d08ce451799ca24f319418d61867b38f6fa2a939 100644 (file)
@@ -124,6 +124,11 @@ impl hyper::service::Service<Uri> for HttpsConnector {
                 .ok_or_else(|| format_err!("missing URL scheme"))?
                 == "https";
 
+            let host = dst
+                .host()
+                .ok_or_else(|| format_err!("missing hostname in destination url?"))?
+                .to_string();
+
             let config = this.ssl_connector.configure();
             let dst_str = dst.to_string(); // for error messages
             let conn = this
@@ -135,7 +140,7 @@ impl hyper::service::Service<Uri> for HttpsConnector {
             let _ = set_tcp_keepalive(conn.as_raw_fd(), PROXMOX_BACKUP_TCP_KEEPALIVE_TIME);
 
             if is_https {
-                let conn: tokio_openssl::SslStream<tokio::net::TcpStream> = tokio_openssl::SslStream::new(config?.into_ssl(&dst_str)?, conn)?;
+                let conn: tokio_openssl::SslStream<tokio::net::TcpStream> = tokio_openssl::SslStream::new(config?.into_ssl(&host)?, conn)?;
                 let mut conn = Box::pin(conn);
                 conn.as_mut().connect().await?;
                 Ok(MaybeTlsStream::Right(conn))