Early data option
Some checks failed
Unit Test / test (push) Has been cancelled
ShiftLeft Scan / Scan-Build (push) Has been cancelled

This commit is contained in:
Pascal Engélibert 2026-01-08 11:05:06 +01:00
commit 9518cc8b73
4 changed files with 23 additions and 6 deletions

View file

@ -206,7 +206,7 @@ where
<B1 as Body>::Error: Into<Box<dyn std::error::Error + Send + Sync + 'static>>,
{
/// Build forwarder
pub async fn try_new(_globals: &Arc<Globals>) -> RpxyResult<Self> {
pub async fn try_new(globals: &Arc<Globals>) -> RpxyResult<Self> {
// build hyper client with rustls and webpki, only https is allowed
#[cfg(feature = "webpki-roots")]
let builder = hyper_rustls::HttpsConnectorBuilder::new().with_webpki_roots();
@ -223,7 +223,11 @@ where
.try_with_platform_verifier()
.unwrap()
.with_no_client_auth();
client_config.resumption = Resumption::disabled();
if globals.proxy_config.enable_early_data {
client_config.enable_early_data = true;
} else {
client_config.resumption = Resumption::disabled();
}
let builder = hyper_rustls::HttpsConnectorBuilder::new().with_tls_config(client_config.clone());
let builder_h2 = hyper_rustls::HttpsConnectorBuilder::new().with_tls_config(client_config);
info!("Rustls backend: Platform verifier used for backend connections");
@ -233,12 +237,12 @@ where
let mut http = HttpConnector::new();
http.enforce_http(false);
http.set_reuse_address(true);
http.set_keepalive(Some(_globals.proxy_config.upstream_idle_timeout));
http.set_keepalive(Some(globals.proxy_config.upstream_idle_timeout));
let connector = builder.https_or_http().enable_all_versions().wrap_connector(http.clone());
let connector_h2 = builder_h2.https_or_http().enable_http2().wrap_connector(http);
let inner = Client::builder(LocalExecutor::new(_globals.runtime_handle.clone())).build::<_, B1>(connector);
let inner_h2 = Client::builder(LocalExecutor::new(_globals.runtime_handle.clone()))
let inner = Client::builder(LocalExecutor::new(globals.runtime_handle.clone())).build::<_, B1>(connector);
let inner_h2 = Client::builder(LocalExecutor::new(globals.runtime_handle.clone()))
.http2_only(true)
.set_host(false)
.build::<_, B1>(connector_h2);

View file

@ -52,6 +52,8 @@ pub struct ProxyConfig {
/// timeout to handle a connection, total time of receive request, serve, and send response. this might limits the max length of response.
pub connection_handling_timeout: Option<Duration>,
pub enable_early_data: bool,
#[cfg(feature = "cache")]
pub cache_enabled: bool,
#[cfg(feature = "cache")]
@ -100,6 +102,8 @@ impl Default for ProxyConfig {
sni_consistency: true,
connection_handling_timeout: None,
enable_early_data: false,
#[cfg(feature = "cache")]
cache_enabled: false,
#[cfg(feature = "cache")]