pub struct HttpProxy<SV, C = ()>where
C: Connector,{
pub server_options: Option<HttpServerOptions>,
pub h2_options: Option<H2Options>,
pub downstream_modules: HttpModules,
/* private fields */
}Expand description
The concrete type that holds the user defined HTTP proxy.
Users don’t need to interact with this object directly.
Fields§
§server_options: Option<HttpServerOptions>§h2_options: Option<H2Options>§downstream_modules: HttpModulesImplementations§
Source§impl<SV> HttpProxy<SV, ()>
impl<SV> HttpProxy<SV, ()>
Sourcepub fn new(inner: SV, conf: Arc<ServerConf>) -> Self
pub fn new(inner: SV, conf: Arc<ServerConf>) -> Self
Create a new HttpProxy with the given ProxyHttp implementation and ServerConf.
After creating an HttpProxy, you should call HttpProxy::handle_init_modules() to
initialize the downstream modules before processing requests.
For most use cases, prefer using http_proxy_service() which wraps the HttpProxy in a
Service. This constructor is useful when you need to integrate HttpProxy into a custom
accept loop (e.g., for SNI-based routing decisions before TLS termination).
§Example
use pingora_proxy::HttpProxy;
use std::sync::Arc;
let mut proxy = HttpProxy::new(my_proxy_app, server_conf);
proxy.handle_init_modules();
let proxy = Arc::new(proxy);
// Use proxy.process_new_http() in your custom accept loopSource§impl<SV, C> HttpProxy<SV, C>where
C: Connector,
impl<SV, C> HttpProxy<SV, C>where
C: Connector,
Sourcepub fn unexpected_data_connection_count(&self) -> u64
pub fn unexpected_data_connection_count(&self) -> u64
Return the number of times a pooled upstream connection was found to contain unexpected data from the server.
Sourcepub fn unexpected_data_connection_counter(&self) -> Arc<AtomicU64> ⓘ
pub fn unexpected_data_connection_counter(&self) -> Arc<AtomicU64> ⓘ
Return a shared reference to the unexpected data connection counter for periodic metric reporting.
Sourcepub fn handle_init_modules(&mut self)where
SV: ProxyHttp,
pub fn handle_init_modules(&mut self)where
SV: ProxyHttp,
Initialize the downstream modules for this proxy.
This method must be called after creating an HttpProxy with HttpProxy::new()
and before processing any requests. It invokes ProxyHttp::init_downstream_modules()
to set up any HTTP modules configured by the user’s proxy implementation.
Note: When using http_proxy_service() or http_proxy_service_with_name(),
this method is called automatically.