1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 20:12:58 +01:00

Fixed unsoundness in AndThenService impl #83

This commit is contained in:
Nikolay Kim 2020-01-15 11:40:15 -08:00
parent fa800aeba3
commit a751899aad
3 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,11 @@
# Changes # Changes
## [1.0.3] - 2020-01-15
### Fixed
* Fixed unsoundness in `AndThenService` impl
## [1.0.2] - 2020-01-08 ## [1.0.2] - 2020-01-08
### Added ### Added

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-service" name = "actix-service"
version = "1.0.2" version = "1.0.3"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix service" description = "Actix service"
keywords = ["network", "framework", "async", "futures"] keywords = ["network", "framework", "async", "futures"]

View File

@ -50,7 +50,7 @@ impl<T: Service> Pipeline<T> {
where where
Self: Sized, Self: Sized,
F: IntoService<U>, F: IntoService<U>,
U: Service<Request = T::Response, Error = T::Error>, U: Service<Request = T::Response, Error = T::Error> + 'static,
{ {
Pipeline { Pipeline {
service: AndThenService::new(self.service, service.into_service()), service: AndThenService::new(self.service, service.into_service()),
@ -69,7 +69,7 @@ impl<T: Service> Pipeline<T> {
where where
Self: Sized, Self: Sized,
I: IntoService<U>, I: IntoService<U>,
U: Service, U: Service + 'static,
F: FnMut(T::Response, &mut U) -> Fut, F: FnMut(T::Response, &mut U) -> Fut,
Fut: Future<Output = Result<Res, Err>>, Fut: Future<Output = Result<Res, Err>>,
Err: From<T::Error> + From<U::Error>, Err: From<T::Error> + From<U::Error>,
@ -88,7 +88,7 @@ impl<T: Service> Pipeline<T> {
where where
Self: Sized, Self: Sized,
F: IntoService<U>, F: IntoService<U>,
U: Service<Request = Result<T::Response, T::Error>, Error = T::Error>, U: Service<Request = Result<T::Response, T::Error>, Error = T::Error> + 'static,
{ {
Pipeline { Pipeline {
service: ThenService::new(self.service, service.into_service()), service: ThenService::new(self.service, service.into_service()),
@ -179,6 +179,7 @@ impl<T: ServiceFactory> PipelineFactory<T> {
Error = T::Error, Error = T::Error,
InitError = T::InitError, InitError = T::InitError,
>, >,
U::Service: 'static,
{ {
PipelineFactory { PipelineFactory {
factory: AndThenServiceFactory::new(self.factory, factory.into_factory()), factory: AndThenServiceFactory::new(self.factory, factory.into_factory()),
@ -199,6 +200,7 @@ impl<T: ServiceFactory> PipelineFactory<T> {
T::Config: Clone, T::Config: Clone,
I: IntoServiceFactory<U>, I: IntoServiceFactory<U>,
U: ServiceFactory<Config = T::Config, InitError = T::InitError>, U: ServiceFactory<Config = T::Config, InitError = T::InitError>,
U::Service: 'static,
F: FnMut(T::Response, &mut U::Service) -> Fut + Clone, F: FnMut(T::Response, &mut U::Service) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>, Fut: Future<Output = Result<Res, Err>>,
Err: From<T::Error> + From<U::Error>, Err: From<T::Error> + From<U::Error>,
@ -225,6 +227,7 @@ impl<T: ServiceFactory> PipelineFactory<T> {
Error = T::Error, Error = T::Error,
InitError = T::InitError, InitError = T::InitError,
>, >,
U::Service: 'static,
{ {
PipelineFactory { PipelineFactory {
factory: ThenServiceFactory::new(self.factory, factory.into_factory()), factory: ThenServiceFactory::new(self.factory, factory.into_factory()),