From ef9bac80ff64fa02aee4a87cacb23147baa3f564 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 17 Mar 2026 12:12:24 +0000 Subject: [PATCH] fix(rustproxy-http): reuse healthy HTTP/2 upstream connections after requests with bodies --- changelog.md | 6 ++++++ rust/crates/rustproxy-http/src/proxy_service.rs | 5 +---- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 94df41c..f469e4f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-03-17 - 25.11.22 - fix(rustproxy-http) +reuse healthy HTTP/2 upstream connections after requests with bodies + +- Registers successful HTTP/2 connections in the pool regardless of whether the proxied request included a body +- Continues to avoid pooling upstream connections that returned 502 Bad Gateway responses + ## 2026-03-17 - 25.11.21 - fix(rustproxy-http) reuse pooled HTTP/2 connections for requests with and without bodies diff --git a/rust/crates/rustproxy-http/src/proxy_service.rs b/rust/crates/rustproxy-http/src/proxy_service.rs index d35d886..6e733c4 100644 --- a/rust/crates/rustproxy-http/src/proxy_service.rs +++ b/rust/crates/rustproxy-http/src/proxy_service.rs @@ -1038,12 +1038,9 @@ impl HttpProxyService { }); } - // Only pool the H2 connection if the request had no body. - // Requests with bodies (uploads) deplete connection-level flow control windows. - let request_had_body = !body.is_end_stream(); let sender_for_pool = sender.clone(); let result = self.forward_h2_with_sender(sender, parts, body, upstream_headers, upstream_path, route, route_id, source_ip, Some(pool_key), domain, conn_activity).await; - if !request_had_body && matches!(&result, Ok(ref resp) if resp.status() != StatusCode::BAD_GATEWAY) { + if matches!(&result, Ok(ref resp) if resp.status() != StatusCode::BAD_GATEWAY) { let g = self.connection_pool.register_h2(pool_key.clone(), sender_for_pool); gen_holder.store(g, std::sync::atomic::Ordering::Relaxed); } diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 0813b10..ae1d252 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartproxy', - version: '25.11.21', + version: '25.11.22', description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.' }