From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4FE41676A4 for ; Tue, 12 Jan 2021 14:58:45 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4E26126FA2 for ; Tue, 12 Jan 2021 14:58:45 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id AEA0D26F77 for ; Tue, 12 Jan 2021 14:58:44 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7BE3645637 for ; Tue, 12 Jan 2021 14:58:44 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Tue, 12 Jan 2021 14:58:24 +0100 Message-Id: <20210112135830.2798301-15-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> References: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [node.rs, backup.rs, reader.rs] Subject: [pbs-devel] [PATCH proxmox-backup 10/12] hyper: use new hyper::upgrade X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 13:58:45 -0000 the old Body::on_upgrade method is no more Signed-off-by: Fabian Grünbichler --- src/api2/backup.rs | 5 ++--- src/api2/node.rs | 5 +++-- src/api2/reader.rs | 5 ++--- src/client/http_client.rs | 5 +---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/api2/backup.rs b/src/api2/backup.rs index f4eed074..bf9c1465 100644 --- a/src/api2/backup.rs +++ b/src/api2/backup.rs @@ -2,7 +2,7 @@ use anyhow::{bail, format_err, Error}; use futures::*; use hyper::header::{HeaderValue, UPGRADE}; use hyper::http::request::Parts; -use hyper::{Body, Response, StatusCode}; +use hyper::{Body, Response, Request, StatusCode}; use serde_json::{json, Value}; use proxmox::{sortable, identity, list_subdirs_api_method}; @@ -171,8 +171,7 @@ async move { let env2 = env.clone(); - let mut req_fut = req_body - .on_upgrade() + let mut req_fut = hyper::upgrade::on(Request::from_parts(parts, req_body)) .map_err(Error::from) .and_then(move |conn| { env2.debug("protocol upgrade done"); diff --git a/src/api2/node.rs b/src/api2/node.rs index 51dfdd19..78e0fa44 100644 --- a/src/api2/node.rs +++ b/src/api2/node.rs @@ -6,6 +6,7 @@ use futures::future::{FutureExt, TryFutureExt}; use hyper::body::Body; use hyper::http::request::Parts; use hyper::upgrade::Upgraded; +use hyper::Request; use serde_json::{json, Value}; use tokio::io::{AsyncBufReadExt, BufReader}; @@ -292,10 +293,10 @@ fn upgrade_to_websocket( Some(&ticket::term_aad(&userid, "/system", port)), )?; - let (ws, response) = WebSocket::new(parts.headers)?; + let (ws, response) = WebSocket::new(parts.headers.clone())?; crate::server::spawn_internal_task(async move { - let conn: Upgraded = match req_body.on_upgrade().map_err(Error::from).await { + let conn: Upgraded = match hyper::upgrade::on(Request::from_parts(parts, req_body)).map_err(Error::from).await { Ok(upgraded) => upgraded, _ => bail!("error"), }; diff --git a/src/api2/reader.rs b/src/api2/reader.rs index 010d73e3..72b6e33a 100644 --- a/src/api2/reader.rs +++ b/src/api2/reader.rs @@ -2,7 +2,7 @@ use anyhow::{bail, format_err, Error}; use futures::*; use hyper::header::{self, HeaderValue, UPGRADE}; use hyper::http::request::Parts; -use hyper::{Body, Response, StatusCode}; +use hyper::{Body, Response, Request, StatusCode}; use serde_json::Value; use proxmox::{sortable, identity}; @@ -130,8 +130,7 @@ fn upgrade_to_backup_reader_protocol( let abort_future = worker.abort_future(); - let req_fut = req_body - .on_upgrade() + let req_fut = hyper::upgrade::on(Request::from_parts(parts, req_body)) .map_err(Error::from) .and_then({ let env = env.clone(); diff --git a/src/client/http_client.rs b/src/client/http_client.rs index 33860abf..3a934062 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -646,10 +646,7 @@ impl HttpClient { bail!("unknown error"); } - let upgraded = resp - .into_body() - .on_upgrade() - .await?; + let upgraded = hyper::upgrade::on(resp).await?; let max_window_size = (1 << 31) - 2; -- 2.20.1