Skip to main content

LocationInstance

Trait LocationInstance 

Source
pub trait LocationInstance: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn upstream(&self) -> &str;
    fn rewrite(
        &self,
        header: &mut RequestHeader,
        variables: Option<AHashMap<String, String>>,
    ) -> (bool, Option<AHashMap<String, String>>);
    fn headers(&self) -> Option<&Vec<(HeaderName, HeaderValue, bool)>>;
    fn client_body_size_limit(&self) -> usize;
    fn on_request(&self) -> Result<(u64, i32)>;
    fn on_response(&self);
}
Expand description

Trait for location instance

Required Methods§

Source

fn name(&self) -> &str

Get location’s name

Source

fn upstream(&self) -> &str

Get the upstream of location

Source

fn rewrite( &self, header: &mut RequestHeader, variables: Option<AHashMap<String, String>>, ) -> (bool, Option<AHashMap<String, String>>)

Rewrite the request url

Source

fn headers(&self) -> Option<&Vec<(HeaderName, HeaderValue, bool)>>

Returns the proxy header to upstream

Source

fn client_body_size_limit(&self) -> usize

Returns the client body size limit

Source

fn on_request(&self) -> Result<(u64, i32)>

Called when the request is received from the client Returns Result<(u64, i32)> - A tuple containing:

  • The new total number of accepted requests (u64)
  • The new number of currently processing requests (i32)
Source

fn on_response(&self)

Called when the response is received from the upstream

Implementors§