Struct FastCgiClientRequest
pub struct FastCgiClientRequest {
pub params: Vec<(Bytes, Bytes)>,
pub stdin: FastCgiBody,
pub extensions: Extensions,
}fastcgi only.Expand description
A FastCGI client request to send to a backend application server.
Construct one with the CGI environment variables (params) and optionally a
request body (stdin), then serve it via FastCgiClient.
stdin is a streaming FastCgiBody; any of Bytes, Vec<u8>, String,
&'static [u8], or an [AsyncRead][tokio::io::AsyncRead] wrapper can be
passed via Self::with_stdin.
Fields§
§params: Vec<(Bytes, Bytes)>CGI environment variables to send as FCGI_PARAMS.
stdin: FastCgiBodyRequest body to send as FCGI_STDIN (may be empty for GET requests).
extensions: ExtensionsExtensions for routing and metadata (e.g. connector target address).
Implementations§
§impl FastCgiClientRequest
impl FastCgiClientRequest
pub fn new(params: impl Into<Vec<(Bytes, Bytes)>>) -> FastCgiClientRequest
pub fn new(params: impl Into<Vec<(Bytes, Bytes)>>) -> FastCgiClientRequest
Create a new FastCgiClientRequest with the given params and an empty stdin.
pub fn with_stdin(self, stdin: impl Into<FastCgiBody>) -> FastCgiClientRequest
pub fn with_stdin(self, stdin: impl Into<FastCgiBody>) -> FastCgiClientRequest
Attach a request body (stdin).
Accepts anything convertible into a FastCgiBody: Bytes,
Vec<u8>, String, &'static [u8], or wrap a streaming reader with
FastCgiBody::from_reader.
pub fn push_param(
&mut self,
name: impl Into<Bytes>,
value: impl Into<Bytes>,
) -> &mut FastCgiClientRequest
pub fn push_param( &mut self, name: impl Into<Bytes>, value: impl Into<Bytes>, ) -> &mut FastCgiClientRequest
Append a single CGI name-value pair to Self::params.
Pair the name with the constants in
proto::cgi to avoid bare-string literals at
call sites:
use rama_fastcgi::{FastCgiClientRequest, proto::cgi};
let mut req = FastCgiClientRequest::new(vec![]);
req.push_param(cgi::SCRIPT_FILENAME, "/var/www/index.php");
req.push_param(cgi::DOCUMENT_ROOT, "/var/www");Both arguments accept anything that converts into Bytes —
&'static [u8], &'static str, Bytes, Vec<u8>, String, etc.
pub fn with_param(
self,
name: impl Into<Bytes>,
value: impl Into<Bytes>,
) -> FastCgiClientRequest
pub fn with_param( self, name: impl Into<Bytes>, value: impl Into<Bytes>, ) -> FastCgiClientRequest
Builder-style sibling of Self::push_param: append a pair and
return self for chaining.
pub fn extensions_mut(&mut self) -> &mut Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
Get a mutable reference to the extensions.
Trait Implementations§
§impl Debug for FastCgiClientRequest
impl Debug for FastCgiClientRequest
§impl ExtensionsRef for FastCgiClientRequest
impl ExtensionsRef for FastCgiClientRequest
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl<S, IO> Service<FastCgiClientRequest> for FastCgiClient<S>where
S: Service<FastCgiClientRequest, Output = EstablishedClientConnection<IO, FastCgiClientRequest>>,
<S as Service<FastCgiClientRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
IO: AsyncRead + AsyncWrite + Unpin + Send + 'static,
impl<S, IO> Service<FastCgiClientRequest> for FastCgiClient<S>where
S: Service<FastCgiClientRequest, Output = EstablishedClientConnection<IO, FastCgiClientRequest>>,
<S as Service<FastCgiClientRequest>>::Error: Into<Box<dyn Error + Send + Sync>>,
IO: AsyncRead + AsyncWrite + Unpin + Send + 'static,
§type Output = FastCgiClientResponse
type Output = FastCgiClientResponse
§async fn serve(
&self,
req: FastCgiClientRequest,
) -> Result<<FastCgiClient<S> as Service<FastCgiClientRequest>>::Output, <FastCgiClient<S> as Service<FastCgiClientRequest>>::Error>
async fn serve( &self, req: FastCgiClientRequest, ) -> Result<<FastCgiClient<S> as Service<FastCgiClientRequest>>::Output, <FastCgiClient<S> as Service<FastCgiClientRequest>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
§impl Service<FastCgiClientRequest> for FastCgiTcpConnector
impl Service<FastCgiClientRequest> for FastCgiTcpConnector
§type Output = EstablishedClientConnection<TcpStream, FastCgiClientRequest>
type Output = EstablishedClientConnection<TcpStream, FastCgiClientRequest>
§async fn serve(
&self,
input: FastCgiClientRequest,
) -> Result<<FastCgiTcpConnector as Service<FastCgiClientRequest>>::Output, <FastCgiTcpConnector as Service<FastCgiClientRequest>>::Error>
async fn serve( &self, input: FastCgiClientRequest, ) -> Result<<FastCgiTcpConnector as Service<FastCgiClientRequest>>::Output, <FastCgiTcpConnector as Service<FastCgiClientRequest>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
§impl Service<FastCgiClientRequest> for FastCgiUnixConnector
impl Service<FastCgiClientRequest> for FastCgiUnixConnector
§type Output = EstablishedClientConnection<UnixStream, FastCgiClientRequest>
type Output = EstablishedClientConnection<UnixStream, FastCgiClientRequest>
§async fn serve(
&self,
input: FastCgiClientRequest,
) -> Result<<FastCgiUnixConnector as Service<FastCgiClientRequest>>::Output, <FastCgiUnixConnector as Service<FastCgiClientRequest>>::Error>
async fn serve( &self, input: FastCgiClientRequest, ) -> Result<<FastCgiUnixConnector as Service<FastCgiClientRequest>>::Output, <FastCgiUnixConnector as Service<FastCgiClientRequest>>::Error>
§fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
fn boxed(self) -> BoxService<Input, Self::Output, Self::Error>
Auto Trait Implementations§
impl Freeze for FastCgiClientRequest
impl !RefUnwindSafe for FastCgiClientRequest
impl Send for FastCgiClientRequest
impl !Sync for FastCgiClientRequest
impl Unpin for FastCgiClientRequest
impl UnsafeUnpin for FastCgiClientRequest
impl !UnwindSafe for FastCgiClientRequest
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer