update to proxmox-http 0.7

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-08-19 13:27:14 +02:00
parent 6171c72778
commit 951cbb96a2
7 changed files with 23 additions and 22 deletions

View File

@ -93,7 +93,7 @@ zstd = { version = "0.6", features = [ "bindgen" ] }
pathpatterns = "0.1.2"
pxar = { version = "0.10.1", features = [ "tokio-io" ] }
proxmox-http = { version = "0.6.4", features = [ "client", "client-trait", "http-helpers", "proxmox-async", "websocket" ] }
proxmox-http = { version = "0.7", features = [ "client", "client-trait", "http-helpers", "proxmox-async", "websocket" ] }
proxmox-io = "1"
proxmox-lang = "1.1"
proxmox-metrics = "0.2"

12
debian/control vendored
View File

@ -47,12 +47,12 @@ Build-Depends: debhelper (>= 12),
librust-proxmox-borrow-1+default-dev,
librust-proxmox-compression-0.1+default-dev (>= 0.1.1-~~),
librust-proxmox-fuse-0.1+default-dev (>= 0.1.3-~~),
librust-proxmox-http-0.6+client-dev (>= 0.6.4-~~),
librust-proxmox-http-0.6+client-trait-dev (>= 0.6.4-~~),
librust-proxmox-http-0.6+default-dev (>= 0.6.4-~~),
librust-proxmox-http-0.6+http-helpers-dev (>= 0.6.4-~~),
librust-proxmox-http-0.6+proxmox-async-dev (>= 0.6.4-~~),
librust-proxmox-http-0.6+websocket-dev (>= 0.6.4-~~),
librust-proxmox-http-0.7+client-dev,
librust-proxmox-http-0.7+client-trait-dev,
librust-proxmox-http-0.7+default-dev,
librust-proxmox-http-0.7+http-helpers-dev,
librust-proxmox-http-0.7+proxmox-async-dev,
librust-proxmox-http-0.7+websocket-dev,
librust-proxmox-io-1+default-dev (>= 1.0.1-~~),
librust-proxmox-io-1+tokio-dev (>= 1.0.1-~~),
librust-proxmox-lang-1+default-dev (>= 1.1-~~),

View File

@ -36,7 +36,7 @@ pathpatterns = "0.1.2"
proxmox-async = "0.4"
proxmox-compression = "0.1.1"
proxmox-fuse = "0.1.3"
proxmox-http = { version = "0.6.4", features = [ "client", "http-helpers", "websocket" ] }
proxmox-http = { version = "0.7", features = [ "client", "http-helpers", "websocket" ] }
proxmox-io = { version = "1.0.1", features = [ "tokio" ] }
proxmox-lang = "1.1"
proxmox-router = { version = "1.2.4", features = [ "cli" ] }

View File

@ -36,7 +36,7 @@ proxmox-async = "0.4"
proxmox-compression = "0.1.1"
proxmox-io = "1"
proxmox-lang = "1.1"
proxmox-http = { version = "0.6.4", features = [ "client" ] }
proxmox-http = { version = "0.7", features = [ "client" ] }
proxmox-router = "1.2.4"
proxmox-schema = { version = "1.3.1", features = [ "api-macro", "upid-api-impl" ] }
proxmox-time = "1"

View File

@ -15,7 +15,7 @@ use proxmox_acme_rs::account::AccountData as AcmeAccountData;
use proxmox_acme_rs::order::{Order, OrderData};
use proxmox_acme_rs::Request as AcmeRequest;
use proxmox_acme_rs::{Account, Authorization, Challenge, Directory, Error, ErrorResponse};
use proxmox_http::client::SimpleHttp;
use proxmox_http::client::Client;
use proxmox_sys::fs::{replace_file, CreateOptions};
use crate::api2::types::AcmeAccountName;
@ -59,7 +59,7 @@ pub struct AcmeClient {
account: Option<Account>,
directory: Option<Directory>,
nonce: Option<String>,
http_client: SimpleHttp,
http_client: Client,
}
impl AcmeClient {
@ -480,7 +480,7 @@ impl AcmeResponse {
impl AcmeClient {
/// Non-self-borrowing run_request version for borrow workarounds.
async fn execute(
http_client: &mut SimpleHttp,
http_client: &mut Client,
request: AcmeRequest,
nonce: &mut Option<String>,
) -> Result<AcmeResponse, Error> {
@ -584,7 +584,7 @@ impl AcmeClient {
}
async fn get_directory<'a, 'b>(
http_client: &mut SimpleHttp,
http_client: &mut Client,
directory_url: &str,
directory: &'a mut Option<Directory>,
nonce: &'b mut Option<String>,
@ -617,7 +617,7 @@ impl AcmeClient {
/// Like `get_directory`, but if the directory provides no nonce, also performs a `HEAD`
/// request on the new nonce URL.
async fn get_dir_nonce<'a, 'b>(
http_client: &mut SimpleHttp,
http_client: &mut Client,
directory_url: &str,
directory: &'a mut Option<Directory>,
nonce: &'b mut Option<String>,
@ -637,7 +637,7 @@ impl AcmeClient {
}
async fn get_nonce<'a>(
http_client: &mut SimpleHttp,
http_client: &mut Client,
nonce: &'a mut Option<String>,
new_nonce_url: &str,
) -> Result<&'a str, Error> {

View File

@ -1,7 +1,8 @@
use anyhow::{bail, format_err, Error};
use serde_json::Value;
use proxmox_http::client::{SimpleHttp, SimpleHttpOptions};
use proxmox_http::client::Client;
use proxmox_http::HttpOptions;
use proxmox_router::{Permission, Router, RpcEnvironment};
use proxmox_schema::api;
use proxmox_subscription::{SubscriptionInfo, SubscriptionStatus};
@ -42,7 +43,7 @@ fn check_and_write_subscription(key: String, server_id: String) -> Result<(), Er
None
};
let client = SimpleHttp::with_options(SimpleHttpOptions {
let client = Client::with_options(HttpOptions {
proxy_config,
user_agent: Some(DEFAULT_USER_AGENT_STRING.to_string()),
tcp_keepalive: Some(PROXMOX_BACKUP_TCP_KEEPALIVE_TIME),

View File

@ -5,7 +5,7 @@ use std::any::Any;
use anyhow::{bail, Error};
use proxmox_http::{client::SimpleHttp, client::SimpleHttpOptions, ProxyConfig};
use proxmox_http::{client::Client, HttpOptions, ProxyConfig};
pub mod apt;
pub mod config;
@ -58,15 +58,15 @@ impl<T: Any> AsAny for T {
pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120;
pub const DEFAULT_USER_AGENT_STRING: &str = "proxmox-backup-client/1.0";
/// Returns a new instance of `SimpleHttp` configured for PBS usage.
pub fn pbs_simple_http(proxy_config: Option<ProxyConfig>) -> SimpleHttp {
let options = SimpleHttpOptions {
/// Returns a new instance of [`Client`](proxmox_http::client::Client) configured for PBS usage.
pub fn pbs_simple_http(proxy_config: Option<ProxyConfig>) -> Client {
let options = HttpOptions {
proxy_config,
user_agent: Some(DEFAULT_USER_AGENT_STRING.to_string()),
tcp_keepalive: Some(PROXMOX_BACKUP_TCP_KEEPALIVE_TIME),
};
SimpleHttp::with_options(options)
Client::with_options(options)
}
pub fn setup_safe_path_env() {