pub struct HttpsListener { /* private fields */ }Implementations§
Source§impl HttpsListener
impl HttpsListener
Sourcepub fn key(&self) -> ListenerKey
pub fn key(&self) -> ListenerKey
This listener’s identity: its address, plus the network interface its socket is bound to when it has one.
Sourcepub fn is(&self, key: &ListenerKey) -> bool
pub fn is(&self, key: &ListenerKey) -> bool
Whether this listener is the one key names.
Sourcepub fn is_http11_disabled(&self) -> bool
pub fn is_http11_disabled(&self) -> bool
Whether this listener rejects clients that do not negotiate h2
via TLS ALPN (including those that omit ALPN). Reads the
disable_http11 knob; defaults to false to preserve the
historical behavior where a missing ALPN silently downgrades
to HTTP/1.1.
Sourcepub fn resolver(&self) -> &Arc<MutexCertificateResolver> ⓘ
pub fn resolver(&self) -> &Arc<MutexCertificateResolver> ⓘ
Borrow the listener’s certificate resolver. Used by the TLS handshake path to snapshot the SAN set of the certificate Sōzu serves for a given SNI, so the H2 router can accept connection coalescing (RFC 7540 §9.1.1 / RFC 9113 §9.1.1) on every authority covered by that cert (RFC 6125 §6.4.3 wildcard handling).
pub fn try_new( config: HttpsListenerConfig, token: Token, ) -> Result<HttpsListener, ListenerError>
Sourcepub fn validate_config(
config: &HttpsListenerConfig,
) -> Result<(), ListenerError>
pub fn validate_config( config: &HttpsListenerConfig, ) -> Result<(), ListenerError>
Validate that a worker can build this HTTPS listener configuration — the
rustls context and the answer templates — WITHOUT constructing the full
listener or binding a socket. Runs the exact fallible steps of
Self::try_new (via the shared Self::create_rustls_context /
Self::build_answers helpers), so master-side validation is faithful
to what the worker will do.
The main process calls this before committing an AddHttpsListener to
its ConfigState and fanning it out, so an invalid listener never
reserves its address and blocks a corrected reload (sozu#1301).
pub fn activate( &mut self, registry: &Registry, tcp_listener: Option<MioTcpListener>, ) -> Result<Token, ListenerError>
pub fn create_rustls_context( config: &HttpsListenerConfig, resolver: Arc<MutexCertificateResolver>, ) -> Result<RustlsServerConfig, ListenerError>
Sourcepub fn check_crls_current(
crls: &[String],
now: i64,
) -> Result<(), ListenerError>
pub fn check_crls_current( crls: &[String], now: i64, ) -> Result<(), ListenerError>
Refuse a CRL already past its nextUpdate at now (seconds since the
Unix epoch): with revocation expiry enforced it would reject every
client it covers, which is better reported when the operator states it
than found at the first handshake.
Main process only, on what an operator states (configuration load, reload, a client request), never on a replay or in a worker: a CRL that lapses while the listener runs must not stop a worker started later from building the listener, or the reload that brings a current CRL would find nothing to patch there. Such a worker builds it and rejects the clients at handshake until that reload.
Sourcepub fn validate_client_auth_policy(
policy: &ClientAuthPolicy,
) -> Result<(), ListenerError>
pub fn validate_client_auth_policy( policy: &ClientAuthPolicy, ) -> Result<(), ListenerError>
Check a client authentication policy the way a listener would build
it, without a listener: the main process runs this on an
UpdateHttpsListenerConfig.client_auth_policy patch before it commits
the patch to its state, so a policy no worker could build is refused
up front rather than fanned out.
Sourcepub fn update_config(
&mut self,
patch: &UpdateHttpsListenerConfig,
) -> Result<(), ListenerError>
pub fn update_config( &mut self, patch: &UpdateHttpsListenerConfig, ) -> Result<(), ListenerError>
Apply a partial-update patch to this listener’s live configuration.
Fields absent in the patch (i.e. None) are preserved unchanged.
If alpn_protocols is present the rustls ServerConfig is rebuilt —
in-flight handshakes keep the old Arc; new ones see the new one.
If http_answers is present only the listener-default templates are
replaced; per-cluster overrides in cluster_custom_answers are kept.
All-or-nothing (sozu-proxy/sozu#1703): the patch is validated, then
applied to a copy of the configuration, and every fallible artifact
(the rustls context, the answer registry) is built from that copy.
Only once all of it succeeded are the copy and the artifacts
committed and the inheriting frontends’ HSTS refreshed, so a refused
patch leaves the listener exactly as it was. The copy is one
HttpsListenerConfig clone per patch, on the command path only.
pub fn add_https_front( &mut self, tls_front: HttpFrontend, ) -> Result<(), ListenerError>
Sourcepub fn add_https_front_with_hsts_origin(
&mut self,
tls_front: HttpFrontend,
hsts_origin: HstsOrigin,
) -> Result<(), ListenerError>
pub fn add_https_front_with_hsts_origin( &mut self, tls_front: HttpFrontend, hsts_origin: HstsOrigin, ) -> Result<(), ListenerError>
Variant of Self::add_https_front that records the origin of
tls_front.hsts so listener-default patches can reflow inheriting
frontends without disturbing explicit per-frontend overrides. The
caller passes crate::router::HstsOrigin::InheritedFromListenerDefault when
the value was filled in from self.config.hsts rather than from
the operator’s per-frontend configuration.
pub fn remove_https_front( &mut self, tls_front: HttpFrontend, ) -> Result<(), ListenerError>
Trait Implementations§
Source§impl L7ListenerHandler for HttpsListener
impl L7ListenerHandler for HttpsListener
fn get_sticky_name(&self) -> &str
Source§fn get_sozu_id_header(&self) -> &str
fn get_sozu_id_header(&self) -> &str
"Sozu-Id". Operators can rebrand via the
sozu_id_header listener config knob.fn get_connect_timeout(&self) -> u32
Source§fn frontend_from_request(
&self,
host: &str,
uri: &str,
method: &Method,
headers: &dyn RequestHeaders,
) -> Result<RouteResult, FrontendFromRequestError>
fn frontend_from_request( &self, host: &str, uri: &str, method: &Method, headers: &dyn RequestHeaders, ) -> Result<RouteResult, FrontendFromRequestError>
Source§fn get_answers(&self) -> &Rc<RefCell<HttpAnswers>>
fn get_answers(&self) -> &Rc<RefCell<HttpAnswers>>
Source§fn get_h2_flood_config(&self) -> H2FloodConfig
fn get_h2_flood_config(&self) -> H2FloodConfig
Source§fn get_h2_connection_config(&self) -> H2ConnectionConfig
fn get_h2_connection_config(&self) -> H2ConnectionConfig
Source§fn get_strict_sni_binding(&self) -> bool
fn get_strict_sni_binding(&self) -> bool
:authority / Host exact-match
the TLS SNI negotiated at handshake (CWE-346 / CWE-444). Read moreSource§fn get_elide_x_real_ip(&self) -> bool
fn get_elide_x_real_ip(&self) -> bool
X-Real-IP header from
forwarded requests (anti-spoofing). Read moreSource§fn get_send_x_real_ip(&self) -> bool
fn get_send_x_real_ip(&self) -> bool
X-Real-IP header carrying the
connection peer IP (post-PROXY-v2 unwrap, i.e. the original client
IP) to every forwarded request. Read moreSource§fn get_forwarded_headers(&self) -> ForwardedHeaders
fn get_forwarded_headers(&self) -> ForwardedHeaders
X-Forwarded-*, RFC 7239 Forwarded, both, or none. Read more