pub struct ConPool { /* private fields */ }
Expand description

manage a pool of Connections to an Server.

Implementations§

source§

impl ConPool

source

pub async fn new(sock_addr: &FCGIAddr) -> Result<ConPool, Box<dyn Error>>

source

pub async fn new_with_strategy( sock_addr: &FCGIAddr, header_mul: MultiHeaderStrategy, header_nl: HeaderMultilineStrategy ) -> Result<ConPool, Box<dyn Error>>

Connect to a FCGI server / application. Queries MAX_CONNS, MAX_REQS and MPXS_CONNS from the server and uses the values to create a Connection.

source

pub async fn forward<B, I, P1, P2>( &self, req: Request<B>, dyn_headers: I ) -> Result<Response<impl HttpBody<Data = Bytes, Error = IoError>>, IoError>where B: HttpBody + Unpin, I: IntoIterator<Item = (P1, P2)>, P1: Buf, P2: Buf,

Forwards an HTTP request to a FGCI Application. Calls Connection::forward on an available connection.

source§

impl ConPool

source

pub async fn prep_server<S>( program: S, sock_addr: &FCGIAddr ) -> Result<Command, IoError>where S: AsRef<OsStr>,

Setup a Command to spin up a FCGI server / application and make it listen on sock_addr.

let mut env = HashMap::new();
env.insert("PHP_FCGI_CHILDREN", "16");
env.insert("PHP_FCGI_MAX_REQUESTS", "10000");
let addr: FCGIAddr = "127.0.0.1:1236".parse()?;
let php = ConPool::prep_server("/usr/bin/php-cgi7.4", &addr)
            .await?
            .env_clear().envs(env)
            .spawn()?;

Trait Implementations§

source§

impl Debug for ConPool

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.