Trait pingora_core::apps::HttpServerApp

source ·
pub trait HttpServerApp {
    // Required method
    fn process_new_http<'life0, 'life1, 'async_trait>(
        self: &'life0 Arc<Self>,
        session: ServerSession,
        shutdown: &'life1 ShutdownWatch
    ) -> Pin<Box<dyn Future<Output = Option<Stream>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn h2_options(&self) -> Option<H2Options> { ... }
    fn http_cleanup<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

This trait defines the interface of an HTTP application.

Required Methods§

source

fn process_new_http<'life0, 'life1, 'async_trait>( self: &'life0 Arc<Self>, session: ServerSession, shutdown: &'life1 ShutdownWatch ) -> Pin<Box<dyn Future<Output = Option<Stream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Similar to the ServerApp, this function is called whenever a new HTTP session is established.

After successful processing, ServerSession::finish() can be called to return an optionally reusable connection back to the service. The caller needs to make sure that the connection is in a reusable state i.e., no error or incomplete read or write headers or bodies. Otherwise a None should be returned.

Provided Methods§

source

fn h2_options(&self) -> Option<H2Options>

Provide options on how HTTP/2 connection should be established. This function will be called every time a new HTTP/2 connection needs to be established.

A None means to use the built-in default options. See server::H2Options for more details.

source

fn http_cleanup<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<SV> HttpServerApp for HttpServer<SV>
where SV: ServeHttp + Send + Sync,

source§

impl<SV> HttpServerApp for SV
where SV: ServeHttp + Send + Sync,