Early data option
This commit is contained in:
parent
e08c70709f
commit
9518cc8b73
4 changed files with 23 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue