Struct actix_http::HttpService
source · [−]pub struct HttpService<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> { /* private fields */ }
Expand description
A ServiceFactory
for HTTP/1.1 or HTTP/2 protocol.
Implementations
impl<S, B, X, U> HttpService<SslStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<SslStream<TcpStream>, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<S, B, X, U> HttpService<SslStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<SslStream<TcpStream>, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
pub fn openssl(
self,
acceptor: SslAcceptor
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = TlsError<HandshakeError<TcpStream>, DispatchError>, InitError = ()>
pub fn openssl(
self,
acceptor: SslAcceptor
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = TlsError<HandshakeError<TcpStream>, DispatchError>, InitError = ()>
Create openssl based service
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TlsStream<TcpStream>, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<S, B, X, U> HttpService<TlsStream<TcpStream>, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TlsStream<TcpStream>, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
pub fn rustls(
self,
config: ServerConfig
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = TlsError<Error, DispatchError>, InitError = ()>
pub fn rustls(
self,
config: ServerConfig
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = TlsError<Error, DispatchError>, InitError = ()>
Create openssl based service
Create builder for HttpService
instance.
Create new HttpService
instance.
Provide service for EXPECT: 100-Continue
support.
Service get called with request that contains EXPECT
header.
Service must return request in case of success, in that case
request will be forwarded to main service.
Provide service for custom Connection: UPGRADE
support.
If service is provided then normal requests handling get halted and this service get called with original request and framed object.
impl<S, B, X, U> HttpService<TcpStream, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TcpStream, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<S, B, X, U> HttpService<TcpStream, S, B, X, U> where
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<TcpStream, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
pub fn tcp(
self
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = DispatchError, InitError = ()>
pub fn tcp(
self
) -> impl ServiceFactory<Config = (), Request = TcpStream, Response = (), Error = DispatchError, InitError = ()>
Create simple tcp stream service
Trait Implementations
impl<T, S, B, X, U> ServiceFactory for HttpService<T, S, B, X, U> where
T: AsyncRead + AsyncWrite + Unpin,
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<T, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
impl<T, S, B, X, U> ServiceFactory for HttpService<T, S, B, X, U> where
T: AsyncRead + AsyncWrite + Unpin,
S: ServiceFactory<Config = (), Request = Request>,
S::Error: Into<Error> + 'static,
S::InitError: Debug,
S::Response: Into<Response<B>> + 'static,
<S::Service as Service>::Future: 'static,
B: MessageBody + 'static,
X: ServiceFactory<Config = (), Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: Debug,
<X::Service as Service>::Future: 'static,
U: ServiceFactory<Config = (), Request = (Request, Framed<T, Codec>), Response = ()>,
U::Error: Display + Into<Error>,
U::InitError: Debug,
<U::Service as Service>::Future: 'static,
type Error = DispatchError
type Error = DispatchError
Errors produced by the created services.
The kind of Service
created by this factory.
type Future = HttpServiceResponse<T, S, B, X, U>
type Future = HttpServiceResponse<T, S, B, X, U>
The future of the Service
instance.
Create and return a new service asynchronously.
Map this service’s output to a different type, returning a new service of the resulting type. Read more
Map this service’s error to a different error, returning a new service.
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E> where
F: Fn(Self::InitError) -> E + Clone,
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E> where
F: Fn(Self::InitError) -> E + Clone,
Map this factory’s init error to a different error, returning a new service.
Auto Trait Implementations
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !RefUnwindSafe for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !Send for HttpService<T, S, B, X, U>
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !Sync for HttpService<T, S, B, X, U>
impl<T, S, B, X, U> Unpin for HttpService<T, S, B, X, U> where
B: Unpin,
S: Unpin,
T: Unpin,
U: Unpin,
X: Unpin,
impl<T, S, B, X = ExpectHandler, U = UpgradeHandler<T>> !UnwindSafe for HttpService<T, S, B, X, U>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Convert Self
to a ServiceFactory
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more