diff --git a/Cargo.toml b/Cargo.toml index 62f91553..bc1e9ed2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,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" @@ -174,7 +173,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 2588631e..1dcb4498 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 356dbc59..a12b5a48 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 f1f08513..5a772802 100644 --- a/examples/h2s-server.rs +++ b/examples/h2s-server.rs @@ -63,8 +63,11 @@ 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 5802fc88..678640e8 100644 --- a/examples/h2server.rs +++ b/examples/h2server.rs @@ -39,8 +39,11 @@ 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 212f62f2..c28fe87c 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 e97b4e54..6b7cfae3 100644 --- a/pbs-client/src/http_client.rs +++ b/pbs-client/src/http_client.rs @@ -4,10 +4,10 @@ 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::client::{Client, HttpConnector}; +use hyper::http::header::HeaderValue; +use hyper::http::Uri; +use hyper::http::{Request, Response}; use hyper::Body; use openssl::{ ssl::{SslConnector, SslMethod}, @@ -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 6d62cd93..38823b54 100644 --- a/pbs-client/src/vsock_client.rs +++ b/pbs-client/src/vsock_client.rs @@ -3,10 +3,10 @@ use std::task::{Context, Poll}; use anyhow::{bail, format_err, Error}; use futures::*; -use http::Uri; -use http::{Request, Response}; use hyper::client::connect::{Connected, Connection}; use hyper::client::Client; +use hyper::http::Uri; +use hyper::http::{Request, Response}; use hyper::Body; use pin_project_lite::pin_project; use serde_json::Value; diff --git a/proxmox-restore-daemon/Cargo.toml b/proxmox-restore-daemon/Cargo.toml index 9d31978b..bcb50d8b 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 e0eeca17..8cfc4f13 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 200cf9cc..c33cfe40 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 c9ebad49..82c6438a 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 7fd07f01..cad74055 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 50f80de4..328141c8 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 7a72d49a..829974d2 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 ce1be1c0..a6d0a332 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -4,9 +4,9 @@ use std::sync::{Arc, Mutex}; use anyhow::{bail, format_err, Context, Error}; use futures::*; -use http::request::Parts; -use http::Response; use hyper::header; +use hyper::http::request::Parts; +use hyper::http::Response; use hyper::{Body, StatusCode}; use tracing::level_filters::LevelFilter; use tracing::{info, warn}; @@ -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 f2da1079..1ea449a4 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 0bd7a7a8..5e3fbdcd 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};