[pbs-devel] [PATCH proxmox 12/17] acme: switch to http/hyper 1.0
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Mar 26 16:23:16 CET 2025
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
proxmox-acme/Cargo.toml | 3 ++-
proxmox-acme/src/async_client.rs | 11 +++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/proxmox-acme/Cargo.toml b/proxmox-acme/Cargo.toml
index f6dbe481..26b92f98 100644
--- a/proxmox-acme/Cargo.toml
+++ b/proxmox-acme/Cargo.toml
@@ -26,6 +26,7 @@ proxmox-schema = { workspace = true, optional = true, features = [ "api-macro" ]
proxmox-http = { workspace = true, optional = true, features = [ "client" ] }
anyhow = { workspace = true, optional = true }
bytes = { workspace = true, optional = true }
+http-body-util = { workspace = true, optional = true }
hyper = { workspace = true, optional = true }
[dependencies.ureq]
@@ -39,7 +40,7 @@ default = [ "impl" ]
api-types = [ "dep:proxmox-schema" ]
impl = [ "api-types", "dep:openssl" ]
client = [ "impl", "dep:ureq", "dep:native-tls"]
-async-client = [ "impl", "dep:hyper", "dep:proxmox-http", "dep:anyhow", "dep:bytes" ]
+async-client = [ "impl", "dep:http-body-util", "dep:hyper", "dep:proxmox-http", "dep:anyhow", "dep:bytes" ]
[dev-dependencies]
anyhow.workspace = true
diff --git a/proxmox-acme/src/async_client.rs b/proxmox-acme/src/async_client.rs
index 6e38570f..a29b6f91 100644
--- a/proxmox-acme/src/async_client.rs
+++ b/proxmox-acme/src/async_client.rs
@@ -2,10 +2,11 @@
use anyhow::format_err;
use bytes::Bytes;
-use hyper::{Body, Request};
+use http_body_util::BodyExt;
+use hyper::Request;
use serde::{Deserialize, Serialize};
-use proxmox_http::client::Client;
+use proxmox_http::{client::Client, Body};
use crate::account::AccountCreator;
use crate::order::{Order, OrderData};
@@ -400,9 +401,11 @@ impl AcmeClient {
let (parts, body) = response.into_parts();
let status = parts.status.as_u16();
- let body = hyper::body::to_bytes(body)
+ let body = body
+ .collect()
.await
- .map_err(|err| Error::Custom(format!("failed to retrieve response body: {}", err)))?;
+ .map_err(|err| Error::Custom(format!("failed to retrieve response body: {}", err)))?
+ .to_bytes();
let got_nonce = if let Some(new_nonce) = parts.headers.get(crate::REPLAY_NONCE) {
let new_nonce = new_nonce.to_str().map_err(|err| {
--
2.39.5
More information about the pbs-devel
mailing list