From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id DFD141FF168 for ; Tue, 21 Jan 2025 13:33:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3B8AE882C; Tue, 21 Jan 2025 13:33:57 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 21 Jan 2025 13:33:19 +0100 Message-Id: <20250121123319.334313-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.222 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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. [sync.rs, h2s-client.rs, mod.rs, h2server.rs, h2s-server.rs, plugin.rs, proxmox-backup-api.rs, auth.rs, proxmox-backup-proxy.rs, tasks.rs, h2client.rs] URIBL_DBL_SPAM 2.5 Contains a spam URL listed in the Spamhaus DBL blocklist [tasks.rs] Subject: [pbs-devel] [PATCH proxmox-backup] cargo: drop direct `http` crate dependency, tree-wide namespace fix 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Instead of using and depending on the `http` create directly, use and depend on the re-exported `hyper::http`. Adapt namespace prefixes accordingly. This makes sure the `hyper::http` types are version compatible and allows to possibly depend on incompatible versions of `http` in the workspace in the future. No functional changes intended. Signed-off-by: Christian Ebner --- Cargo.toml | 2 -- examples/h2client.rs | 2 +- examples/h2s-client.rs | 2 +- examples/h2s-server.rs | 4 ++-- examples/h2server.rs | 4 ++-- pbs-client/Cargo.toml | 1 - pbs-client/src/http_client.rs | 8 ++++---- pbs-client/src/vsock_client.rs | 4 ++-- proxmox-restore-daemon/Cargo.toml | 1 - proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs | 4 ++-- src/acme/plugin.rs | 4 ++-- src/api2/backup/mod.rs | 2 +- src/api2/node/tasks.rs | 4 ++-- src/api2/reader/mod.rs | 2 +- src/bin/proxmox-backup-api.rs | 2 +- src/bin/proxmox-backup-proxy.rs | 8 ++++---- src/server/auth.rs | 2 +- src/server/sync.rs | 2 +- 18 files changed, 27 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index adeeb6efa..ab066fff0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,7 +128,6 @@ futures = "0.3" h2 = { version = "0.4", features = [ "stream" ] } handlebars = "3.0" hex = "0.4.3" -http = "0.2" hyper = { version = "0.14", features = [ "full" ] } libc = "0.2" log = "0.4.17" @@ -175,7 +174,6 @@ endian_trait.workspace = true futures.workspace = true h2.workspace = true hex.workspace = true -http.workspace = true hyper.workspace = true libc.workspace = true log.workspace = true diff --git a/examples/h2client.rs b/examples/h2client.rs index 2588631e4..1dcb44987 100644 --- a/examples/h2client.rs +++ b/examples/h2client.rs @@ -54,7 +54,7 @@ fn send_request( ) -> impl Future> { println!("sending request"); - let request = http::Request::builder() + let request = hyper::http::Request::builder() .uri("http://localhost/") .body(()) .unwrap(); diff --git a/examples/h2s-client.rs b/examples/h2s-client.rs index 356dbc592..a12b5a484 100644 --- a/examples/h2s-client.rs +++ b/examples/h2s-client.rs @@ -54,7 +54,7 @@ fn send_request( ) -> impl Future> { println!("sending request"); - let request = http::Request::builder() + let request = hyper::http::Request::builder() .uri("http://localhost/") .body(()) .unwrap(); diff --git a/examples/h2s-server.rs b/examples/h2s-server.rs index f1f085137..52c4568a5 100644 --- a/examples/h2s-server.rs +++ b/examples/h2s-server.rs @@ -63,8 +63,8 @@ async fn handle_connection(socket: TcpStream, acceptor: Arc) -> Res let body = Body::from(buffer); let response = Response::builder() - .status(http::StatusCode::OK) - .header(http::header::CONTENT_TYPE, "application/octet-stream") + .status(hyper::http::StatusCode::OK) + .header(hyper::http::header::CONTENT_TYPE, "application/octet-stream") .body(body) .unwrap(); future::ok::<_, Error>(response) diff --git a/examples/h2server.rs b/examples/h2server.rs index 5802fc888..2d2715f13 100644 --- a/examples/h2server.rs +++ b/examples/h2server.rs @@ -39,8 +39,8 @@ async fn handle_connection(socket: TcpStream) -> Result<(), Error> { let body = Body::from(buffer); let response = Response::builder() - .status(http::StatusCode::OK) - .header(http::header::CONTENT_TYPE, "application/octet-stream") + .status(hyper::http::StatusCode::OK) + .header(hyper::http::header::CONTENT_TYPE, "application/octet-stream") .body(body) .unwrap(); future::ok::<_, Error>(response) diff --git a/pbs-client/Cargo.toml b/pbs-client/Cargo.toml index 212f62f2a..c28fe87ca 100644 --- a/pbs-client/Cargo.toml +++ b/pbs-client/Cargo.toml @@ -12,7 +12,6 @@ bytes.workspace = true futures.workspace = true h2.workspace = true hex.workspace = true -http.workspace = true hyper.workspace = true libc.workspace = true nix.workspace = true diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs index e97b4e549..48cb776dc 100644 --- a/pbs-client/src/http_client.rs +++ b/pbs-client/src/http_client.rs @@ -4,9 +4,9 @@ use std::time::Duration; use anyhow::{bail, format_err, Error}; use futures::*; -use http::header::HeaderValue; -use http::Uri; -use http::{Request, Response}; +use hyper::http::header::HeaderValue; +use hyper::http::Uri; +use hyper::http::{Request, Response}; use hyper::client::{Client, HttpConnector}; use hyper::Body; use openssl::{ @@ -782,7 +782,7 @@ impl HttpClient { .map_err(|_| format_err!("http upgrade request timed out"))??; let status = resp.status(); - if status != http::StatusCode::SWITCHING_PROTOCOLS { + if status != hyper::http::StatusCode::SWITCHING_PROTOCOLS { Self::api_response(resp).await?; bail!("unknown error"); } diff --git a/pbs-client/src/vsock_client.rs b/pbs-client/src/vsock_client.rs index 6d62cd93f..25aa69cb9 100644 --- a/pbs-client/src/vsock_client.rs +++ b/pbs-client/src/vsock_client.rs @@ -3,8 +3,8 @@ use std::task::{Context, Poll}; use anyhow::{bail, format_err, Error}; use futures::*; -use http::Uri; -use http::{Request, Response}; +use hyper::http::Uri; +use hyper::http::{Request, Response}; use hyper::client::connect::{Connected, Connection}; use hyper::client::Client; use hyper::Body; diff --git a/proxmox-restore-daemon/Cargo.toml b/proxmox-restore-daemon/Cargo.toml index 9d31978b1..bcb50d8ba 100644 --- a/proxmox-restore-daemon/Cargo.toml +++ b/proxmox-restore-daemon/Cargo.toml @@ -11,7 +11,6 @@ anyhow.workspace = true base64.workspace = true env_logger.workspace = true futures.workspace = true -http.workspace = true hyper.workspace = true libc.workspace = true log.workspace = true diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs index e0eeca170..8cfc4f13c 100644 --- a/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs +++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs @@ -6,7 +6,7 @@ use std::pin::Pin; use std::sync::Arc; use anyhow::{bail, format_err, Error}; -use http::HeaderMap; +use hyper::http::HeaderMap; use hyper::{Body, Method, Response, StatusCode}; use proxmox_router::UserInformation; @@ -64,7 +64,7 @@ pub fn check_auth<'a>( }) } -pub fn get_index() -> Pin> + Send>> { +pub fn get_index() -> Pin> + Send>> { Box::pin(async move { let index = "

Proxmox Backup Restore Daemon/h1>

"; diff --git a/src/acme/plugin.rs b/src/acme/plugin.rs index 200cf9cc3..c33cfe405 100644 --- a/src/acme/plugin.rs +++ b/src/acme/plugin.rs @@ -241,12 +241,12 @@ async fn standalone_respond( ) -> Result, hyper::Error> { if req.method() == hyper::Method::GET && req.uri().path() == path.as_str() { Ok(Response::builder() - .status(http::StatusCode::OK) + .status(hyper::http::StatusCode::OK) .body(key_auth.as_bytes().to_vec().into()) .unwrap()) } else { Ok(Response::builder() - .status(http::StatusCode::NOT_FOUND) + .status(hyper::http::StatusCode::NOT_FOUND) .body("Not found.".into()) .unwrap()) } diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs index c9ebad498..82c6438aa 100644 --- a/src/api2/backup/mod.rs +++ b/src/api2/backup/mod.rs @@ -108,7 +108,7 @@ fn upgrade_to_backup_protocol( bail!("invalid protocol name"); } - if parts.version >= http::version::Version::HTTP_2 { + if parts.version >= hyper::http::version::Version::HTTP_2 { bail!( "unexpected http version '{:?}' (expected version < 2)", parts.version diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs index 7fd07f01b..cad740559 100644 --- a/src/api2/node/tasks.rs +++ b/src/api2/node/tasks.rs @@ -3,8 +3,8 @@ use std::io::{BufRead, BufReader}; use anyhow::{bail, Error}; use futures::FutureExt; -use http::request::Parts; -use http::{header, Response, StatusCode}; +use hyper::http::request::Parts; +use hyper::http::{header, Response, StatusCode}; use hyper::Body; use serde_json::{json, Value}; diff --git a/src/api2/reader/mod.rs b/src/api2/reader/mod.rs index 50f80de43..328141c8b 100644 --- a/src/api2/reader/mod.rs +++ b/src/api2/reader/mod.rs @@ -106,7 +106,7 @@ fn upgrade_to_backup_reader_protocol( bail!("invalid protocol name"); } - if parts.version >= http::version::Version::HTTP_2 { + if parts.version >= hyper::http::version::Version::HTTP_2 { bail!( "unexpected http version '{:?}' (expected version < 2)", parts.version diff --git a/src/bin/proxmox-backup-api.rs b/src/bin/proxmox-backup-api.rs index 7a72d49a4..829974d25 100644 --- a/src/bin/proxmox-backup-api.rs +++ b/src/bin/proxmox-backup-api.rs @@ -3,7 +3,7 @@ use std::pin::{pin, Pin}; use anyhow::{bail, Error}; use futures::*; -use http::Response; +use hyper::http::Response; use hyper::{Body, StatusCode}; use tracing::level_filters::LevelFilter; diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index ce1be1c0d..e67a3bd22 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -4,8 +4,8 @@ use std::sync::{Arc, Mutex}; use anyhow::{bail, format_err, Context, Error}; use futures::*; -use http::request::Parts; -use http::Response; +use hyper::http::request::Parts; +use hyper::http::Response; use hyper::header; use hyper::{Body, StatusCode}; use tracing::level_filters::LevelFilter; @@ -75,7 +75,7 @@ fn main() -> Result<(), Error> { /// check for a cookie with the user-preferred language, fallback to the config one if not set or /// not existing -fn get_language(headers: &http::HeaderMap) -> String { +fn get_language(headers: &hyper::http::HeaderMap) -> String { let exists = |l: &str| Path::new(&format!("/usr/share/pbs-i18n/pbs-lang-{l}.js")).exists(); match cookie_from_header(headers, "PBSLangCookie") { @@ -87,7 +87,7 @@ fn get_language(headers: &http::HeaderMap) -> String { } } -fn get_theme(headers: &http::HeaderMap) -> String { +fn get_theme(headers: &hyper::http::HeaderMap) -> String { let exists = |t: &str| { t.len() < 32 && !t.contains('/') diff --git a/src/server/auth.rs b/src/server/auth.rs index f2da10795..1ea449a40 100644 --- a/src/server/auth.rs +++ b/src/server/auth.rs @@ -4,7 +4,7 @@ use proxmox_router::UserInformation; use pbs_config::CachedUserInfo; pub async fn check_pbs_auth( - headers: &http::HeaderMap, + headers: &hyper::http::HeaderMap, method: &hyper::Method, ) -> Result<(String, Box), AuthError> { let user_info = CachedUserInfo::new()?; diff --git a/src/server/sync.rs b/src/server/sync.rs index 0bd7a7a85..5e3fbdcd7 100644 --- a/src/server/sync.rs +++ b/src/server/sync.rs @@ -9,7 +9,7 @@ use std::time::Duration; use anyhow::{bail, format_err, Context, Error}; use futures::{future::FutureExt, select}; -use http::StatusCode; +use hyper::http::StatusCode; use serde_json::json; use tracing::{info, warn}; -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel