- The one patch previously pulled from the AUR packaging is now vendored, due to not being updated (yet) there and needing a refresh. - A new patch is introduced to revert a commit with very much upstream-specific change in the `h2` crate, which is not applicable here. Also closes #412778. Signed-off-by: Christoph Heiss <christoph@c8h4.io>
199 lines
6.9 KiB
Diff
199 lines
6.9 KiB
Diff
From b1a06f6a63a63410f89bd0d2968a6fdb7ce2352d Mon Sep 17 00:00:00 2001
|
|
From: Christoph Heiss <christoph@c8h4.io>
|
|
Date: Thu, 5 Jun 2025 12:01:10 +0200
|
|
Subject: [PATCH 5/5] Revert "h2: switch to legacy feature"
|
|
|
|
This reverts commit 168ed370263e84a6235968c615b856b9280debe1.
|
|
|
|
It's a Proxmox-specific workaround (see also the commit description
|
|
itself) and does not apply here.
|
|
|
|
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
|
|
---
|
|
Cargo.toml | 2 +-
|
|
examples/h2client.rs | 6 +++---
|
|
examples/h2s-client.rs | 6 +++---
|
|
pbs-client/src/backup_writer.rs | 8 ++++----
|
|
pbs-client/src/http_client.rs | 12 +++++-------
|
|
pbs-client/src/pipe_to_stream.rs | 2 +-
|
|
6 files changed, 17 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/Cargo.toml b/Cargo.toml
|
|
index 091696f1..063f62f8 100644
|
|
--- a/Cargo.toml
|
|
+++ b/Cargo.toml
|
|
@@ -122,7 +122,7 @@ env_logger = "0.11"
|
|
flate2 = "1.0"
|
|
foreign-types = "0.3"
|
|
futures = "0.3"
|
|
-h2 = { version = "0.4", features = [ "legacy", "stream" ] }
|
|
+h2 = { version = "0.4", features = [ "stream" ] }
|
|
handlebars = "3.0"
|
|
hex = "0.4.3"
|
|
hickory-resolver = { version = "0.24.1", default-features = false, features = [ "system-config", "tokio-runtime" ] }
|
|
diff --git a/examples/h2client.rs b/examples/h2client.rs
|
|
index e44c43fa..1dcb4498 100644
|
|
--- a/examples/h2client.rs
|
|
+++ b/examples/h2client.rs
|
|
@@ -10,7 +10,7 @@ use tokio::net::TcpStream;
|
|
// Simple H2 client to test H2 download speed using h2server.rs
|
|
|
|
struct Process {
|
|
- body: h2::legacy::RecvStream,
|
|
+ body: h2::RecvStream,
|
|
trailers: bool,
|
|
bytes: usize,
|
|
}
|
|
@@ -50,7 +50,7 @@ impl Future for Process {
|
|
}
|
|
|
|
fn send_request(
|
|
- mut client: h2::legacy::client::SendRequest<bytes::Bytes>,
|
|
+ mut client: h2::client::SendRequest<bytes::Bytes>,
|
|
) -> impl Future<Output = Result<usize, Error>> {
|
|
println!("sending request");
|
|
|
|
@@ -78,7 +78,7 @@ async fn run() -> Result<(), Error> {
|
|
let conn = TcpStream::connect(std::net::SocketAddr::from(([127, 0, 0, 1], 8008))).await?;
|
|
conn.set_nodelay(true).unwrap();
|
|
|
|
- let (client, h2) = h2::legacy::client::Builder::new()
|
|
+ let (client, h2) = h2::client::Builder::new()
|
|
.initial_connection_window_size(1024 * 1024 * 1024)
|
|
.initial_window_size(1024 * 1024 * 1024)
|
|
.max_frame_size(4 * 1024 * 1024)
|
|
diff --git a/examples/h2s-client.rs b/examples/h2s-client.rs
|
|
index 86b3a931..a12b5a48 100644
|
|
--- a/examples/h2s-client.rs
|
|
+++ b/examples/h2s-client.rs
|
|
@@ -10,7 +10,7 @@ use tokio::net::TcpStream;
|
|
// Simple H2 client to test H2 download speed using h2s-server.rs
|
|
|
|
struct Process {
|
|
- body: h2::legacy::RecvStream,
|
|
+ body: h2::RecvStream,
|
|
trailers: bool,
|
|
bytes: usize,
|
|
}
|
|
@@ -50,7 +50,7 @@ impl Future for Process {
|
|
}
|
|
|
|
fn send_request(
|
|
- mut client: h2::legacy::client::SendRequest<bytes::Bytes>,
|
|
+ mut client: h2::client::SendRequest<bytes::Bytes>,
|
|
) -> impl Future<Output = Result<usize, Error>> {
|
|
println!("sending request");
|
|
|
|
@@ -94,7 +94,7 @@ async fn run() -> Result<(), Error> {
|
|
.await
|
|
.map_err(|err| format_err!("connect failed - {}", err))?;
|
|
|
|
- let (client, h2) = h2::legacy::client::Builder::new()
|
|
+ let (client, h2) = h2::client::Builder::new()
|
|
.initial_connection_window_size(1024 * 1024 * 1024)
|
|
.initial_window_size(1024 * 1024 * 1024)
|
|
.max_frame_size(4 * 1024 * 1024)
|
|
diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs
|
|
index 32542506..1253ef56 100644
|
|
--- a/pbs-client/src/backup_writer.rs
|
|
+++ b/pbs-client/src/backup_writer.rs
|
|
@@ -56,7 +56,7 @@ pub struct UploadOptions {
|
|
}
|
|
|
|
struct ChunkUploadResponse {
|
|
- future: h2::legacy::client::ResponseFuture,
|
|
+ future: h2::client::ResponseFuture,
|
|
size: usize,
|
|
}
|
|
|
|
@@ -143,7 +143,7 @@ impl BackupWriter {
|
|
param: Option<Value>,
|
|
content_type: &str,
|
|
data: Vec<u8>,
|
|
- ) -> Result<h2::legacy::client::ResponseFuture, Error> {
|
|
+ ) -> Result<h2::client::ResponseFuture, Error> {
|
|
let request =
|
|
H2Client::request_builder("localhost", method, path, param, Some(content_type))
|
|
.unwrap();
|
|
@@ -514,7 +514,7 @@ impl BackupWriter {
|
|
}
|
|
|
|
fn response_queue() -> (
|
|
- mpsc::Sender<h2::legacy::client::ResponseFuture>,
|
|
+ mpsc::Sender<h2::client::ResponseFuture>,
|
|
oneshot::Receiver<Result<(), Error>>,
|
|
) {
|
|
let (verify_queue_tx, verify_queue_rx) = mpsc::channel(100);
|
|
@@ -537,7 +537,7 @@ impl BackupWriter {
|
|
tokio::spawn(
|
|
ReceiverStream::new(verify_queue_rx)
|
|
.map(Ok::<_, Error>)
|
|
- .try_for_each(move |response: h2::legacy::client::ResponseFuture| {
|
|
+ .try_for_each(move |response: h2::client::ResponseFuture| {
|
|
response
|
|
.map_err(Error::from)
|
|
.and_then(H2Client::h2api_response)
|
|
diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
|
|
index c95def07..8f6f8b41 100644
|
|
--- a/pbs-client/src/http_client.rs
|
|
+++ b/pbs-client/src/http_client.rs
|
|
@@ -863,7 +863,7 @@ impl HttpClient {
|
|
|
|
let max_window_size = (1 << 31) - 2;
|
|
|
|
- let (h2, connection) = h2::legacy::client::Builder::new()
|
|
+ let (h2, connection) = h2::client::Builder::new()
|
|
.initial_connection_window_size(max_window_size)
|
|
.initial_window_size(max_window_size)
|
|
.max_frame_size(4 * 1024 * 1024)
|
|
@@ -1008,11 +1008,11 @@ impl Drop for HttpClient {
|
|
|
|
#[derive(Clone)]
|
|
pub struct H2Client {
|
|
- h2: h2::legacy::client::SendRequest<bytes::Bytes>,
|
|
+ h2: h2::client::SendRequest<bytes::Bytes>,
|
|
}
|
|
|
|
impl H2Client {
|
|
- pub fn new(h2: h2::legacy::client::SendRequest<bytes::Bytes>) -> Self {
|
|
+ pub fn new(h2: h2::client::SendRequest<bytes::Bytes>) -> Self {
|
|
Self { h2 }
|
|
}
|
|
|
|
@@ -1092,7 +1092,7 @@ impl H2Client {
|
|
&self,
|
|
request: Request<()>,
|
|
data: Option<bytes::Bytes>,
|
|
- ) -> impl Future<Output = Result<h2::legacy::client::ResponseFuture, Error>> {
|
|
+ ) -> impl Future<Output = Result<h2::client::ResponseFuture, Error>> {
|
|
self.h2
|
|
.clone()
|
|
.ready()
|
|
@@ -1109,9 +1109,7 @@ impl H2Client {
|
|
})
|
|
}
|
|
|
|
- pub async fn h2api_response(
|
|
- response: Response<h2::legacy::RecvStream>,
|
|
- ) -> Result<Value, Error> {
|
|
+ pub async fn h2api_response(response: Response<h2::RecvStream>) -> Result<Value, Error> {
|
|
let status = response.status();
|
|
|
|
let (_head, mut body) = response.into_parts();
|
|
diff --git a/pbs-client/src/pipe_to_stream.rs b/pbs-client/src/pipe_to_stream.rs
|
|
index 3fc942d3..ae689851 100644
|
|
--- a/pbs-client/src/pipe_to_stream.rs
|
|
+++ b/pbs-client/src/pipe_to_stream.rs
|
|
@@ -8,7 +8,7 @@ use std::task::{Context, Poll};
|
|
use anyhow::{format_err, Error};
|
|
use bytes::Bytes;
|
|
use futures::{ready, Future};
|
|
-use h2::legacy::SendStream;
|
|
+use h2::SendStream;
|
|
|
|
pub struct PipeToSendStream {
|
|
body_tx: SendStream<Bytes>,
|
|
--
|
|
2.49.0
|
|
|