Struct async_fcgi::client::con_pool::ConPool
source · pub struct ConPool { /* private fields */ }Expand description
manage a pool of Connections to an Server.
Implementations§
source§impl ConPool
impl ConPool
sourcepub async fn new(sock_addr: &Addr) -> Result<ConPool, Box<dyn Error>>
pub async fn new(sock_addr: &Addr) -> Result<ConPool, Box<dyn Error>>
Connect to a FCGI server / application with MultiHeaderStrategy::OnlyFirst & HeaderMultilineStrategy::Ignore.
See ConPool::new_with_strategy
sourcepub async fn new_with_strategy(
sock_addr: &Addr,
header_mul: MultiHeaderStrategy,
header_nl: HeaderMultilineStrategy
) -> Result<ConPool, Box<dyn Error>>
pub async fn new_with_strategy( sock_addr: &Addr, 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.
sourcepub 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,
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
impl ConPool
sourcepub async fn prep_server<S>(
program: S,
sock_addr: &Addr
) -> Result<Command, IoError>where
S: AsRef<OsStr>,
pub async fn prep_server<S>( program: S, sock_addr: &Addr ) -> 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§
Auto Trait Implementations§
impl !RefUnwindSafe for ConPool
impl Send for ConPool
impl Sync for ConPool
impl Unpin for ConPool
impl !UnwindSafe for ConPool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more