upgrade to service 0.4

This commit is contained in:
Nikolay Kim 2022-12-26 17:14:39 +01:00
parent fe92ba2e8c
commit 440c0073d0
10 changed files with 64 additions and 65 deletions

View file

@ -6,3 +6,13 @@ members = [
"ntex-multipart", "ntex-multipart",
"ntex-session", "ntex-session",
] ]
[patch.crates-io]
ntex = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-connect = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-io = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-service = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-util = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-tls = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-tokio = { git = "https://github.com/ntex-rs/ntex.git", branch = "service-0-4" }
ntex-h2 = { git = "https://github.com/ntex-rs/ntex-h2.git", branch = "service-0-4" }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-cors" name = "ntex-cors"
version = "0.2.0" version = "0.3.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Cross-origin resource sharing (CORS) for ntex applications." description = "Cross-origin resource sharing (CORS) for ntex applications."
readme = "README.md" readme = "README.md"
@ -16,9 +16,9 @@ name = "ntex_cors"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "0.5.14" ntex = "0.6.0-alpha.0"
derive_more = "0.99" derive_more = "0.99"
futures = "0.3" futures = "0.3"
[dev-dependencies] [dev-dependencies]
ntex = { version = "0.5", features=["tokio"] } ntex = { version = "0.6.0-alpha.0", features=["tokio"] }

View file

@ -54,7 +54,7 @@ use derive_more::Display;
use futures::future::{ok, Either, FutureExt, LocalBoxFuture, Ready}; use futures::future::{ok, Either, FutureExt, LocalBoxFuture, Ready};
use ntex::http::header::{self, HeaderName, HeaderValue}; use ntex::http::header::{self, HeaderName, HeaderValue};
use ntex::http::{error::HttpError, HeaderMap, Method, RequestHead, StatusCode, Uri}; use ntex::http::{error::HttpError, HeaderMap, Method, RequestHead, StatusCode, Uri};
use ntex::service::{Service, Transform}; use ntex::service::{Middleware, Service};
use ntex::web::{ use ntex::web::{
DefaultError, ErrorRenderer, HttpResponse, WebRequest, WebResponse, WebResponseError, DefaultError, ErrorRenderer, HttpResponse, WebRequest, WebResponse, WebResponseError,
}; };
@ -721,14 +721,13 @@ pub struct CorsFactory<Err> {
_t: PhantomData<Err>, _t: PhantomData<Err>,
} }
impl<S, Err> Transform<S> for CorsFactory<Err> impl<S, Err> Middleware<S> for CorsFactory<Err>
where where
S: Service<WebRequest<Err>, Response = WebResponse>, S: Service<WebRequest<Err>, Response = WebResponse>,
S::Future: 'static,
{ {
type Service = CorsMiddleware<S>; type Service = CorsMiddleware<S>;
fn new_transform(&self, service: S) -> Self::Service { fn create(&self, service: S) -> Self::Service {
CorsMiddleware { service, inner: self.inner.clone() } CorsMiddleware { service, inner: self.inner.clone() }
} }
} }
@ -746,17 +745,16 @@ pub struct CorsMiddleware<S> {
impl<S, Err> Service<WebRequest<Err>> for CorsMiddleware<S> impl<S, Err> Service<WebRequest<Err>> for CorsMiddleware<S>
where where
S: Service<WebRequest<Err>, Response = WebResponse>, S: Service<WebRequest<Err>, Response = WebResponse>,
S::Future: 'static,
Err: ErrorRenderer, Err: ErrorRenderer,
Err::Container: From<S::Error>, Err::Container: From<S::Error>,
CorsError: WebResponseError<Err>, CorsError: WebResponseError<Err>,
{ {
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
type Future = Either< type Future<'f> = Either<
Ready<Result<Self::Response, S::Error>>, Ready<Result<Self::Response, S::Error>>,
LocalBoxFuture<'static, Result<Self::Response, S::Error>>, LocalBoxFuture<'f, Result<Self::Response, S::Error>>,
>; > where Self: 'f;
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx) self.service.poll_ready(cx)
@ -766,7 +764,7 @@ where
self.service.poll_shutdown(cx, is_error) self.service.poll_shutdown(cx, is_error)
} }
fn call(&self, req: WebRequest<Err>) -> Self::Future { fn call(&self, req: WebRequest<Err>) -> Self::Future<'_> {
match self.inner.preflight_check(req.head()) { match self.inner.preflight_check(req.head()) {
Ok(Either::Left(res)) => Either::Left(ok(req.into_response(res))), Ok(Either::Left(res)) => Either::Left(ok(req.into_response(res))),
Ok(Either::Right(_)) => { Ok(Either::Right(_)) => {
@ -794,7 +792,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use ntex::service::{fn_service, Transform}; use ntex::service::{fn_service, Middleware};
use ntex::web::{self, test, test::TestRequest}; use ntex::web::{self, test, test::TestRequest};
use super::*; use super::*;
@ -808,7 +806,7 @@ mod tests {
#[ntex::test] #[ntex::test]
async fn validate_origin_allows_all_origins() { async fn validate_origin_allows_all_origins() {
let cors = Cors::new().finish().new_transform(test::ok_service()); let cors = Cors::new().finish().create(test::ok_service());
let req = let req =
TestRequest::with_header("Origin", "https://www.example.com").to_srv_request(); TestRequest::with_header("Origin", "https://www.example.com").to_srv_request();
@ -818,7 +816,7 @@ mod tests {
#[ntex::test] #[ntex::test]
async fn default() { async fn default() {
let cors = Cors::default().new_transform(test::ok_service()); let cors = Cors::default().create(test::ok_service());
let req = let req =
TestRequest::with_header("Origin", "https://www.example.com").to_srv_request(); TestRequest::with_header("Origin", "https://www.example.com").to_srv_request();
@ -835,7 +833,7 @@ mod tests {
.allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT])
.allowed_header(header::CONTENT_TYPE) .allowed_header(header::CONTENT_TYPE)
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://www.example.com") let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::OPTIONS) .method(Method::OPTIONS)
@ -914,7 +912,7 @@ mod tests {
let cors = Cors::new() let cors = Cors::new()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
.finish() .finish()
.new_transform(test::ok_service::<web::DefaultError>()); .create(test::ok_service::<web::DefaultError>());
let req = TestRequest::with_header("Origin", "https://www.unknown.com") let req = TestRequest::with_header("Origin", "https://www.unknown.com")
.method(Method::GET) .method(Method::GET)
@ -929,7 +927,7 @@ mod tests {
let cors = Cors::new() let cors = Cors::new()
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://www.example.com") let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::GET) .method(Method::GET)
@ -941,7 +939,7 @@ mod tests {
#[ntex::test] #[ntex::test]
async fn test_no_origin_response() { async fn test_no_origin_response() {
let cors = Cors::new().disable_preflight().finish().new_transform(test::ok_service()); let cors = Cors::new().disable_preflight().finish().create(test::ok_service());
let req = TestRequest::default().method(Method::GET).to_srv_request(); let req = TestRequest::default().method(Method::GET).to_srv_request();
let resp = test::call_service(&cors, req).await; let resp = test::call_service(&cors, req).await;
@ -969,7 +967,7 @@ mod tests {
.expose_headers(exposed_headers.clone()) .expose_headers(exposed_headers.clone())
.allowed_header(header::CONTENT_TYPE) .allowed_header(header::CONTENT_TYPE)
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://www.example.com") let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::OPTIONS) .method(Method::OPTIONS)
@ -1009,7 +1007,7 @@ mod tests {
.expose_headers(exposed_headers.clone()) .expose_headers(exposed_headers.clone())
.allowed_header(header::CONTENT_TYPE) .allowed_header(header::CONTENT_TYPE)
.finish() .finish()
.new_transform(fn_service(|req: WebRequest<DefaultError>| { .create(fn_service(|req: WebRequest<DefaultError>| {
ok::<_, std::convert::Infallible>(req.into_response( ok::<_, std::convert::Infallible>(req.into_response(
HttpResponse::Ok().header(header::VARY, "Accept").finish(), HttpResponse::Ok().header(header::VARY, "Accept").finish(),
)) ))
@ -1028,7 +1026,7 @@ mod tests {
.allowed_origin("https://www.example.com") .allowed_origin("https://www.example.com")
.allowed_origin("https://www.google.com") .allowed_origin("https://www.google.com")
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://www.example.com") let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::OPTIONS) .method(Method::OPTIONS)
@ -1049,7 +1047,7 @@ mod tests {
.allowed_origin("https://example.org") .allowed_origin("https://example.org")
.allowed_methods(vec![Method::GET]) .allowed_methods(vec![Method::GET])
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://example.com") let req = TestRequest::with_header("Origin", "https://example.com")
.method(Method::GET) .method(Method::GET)
@ -1079,7 +1077,7 @@ mod tests {
.allowed_origin("https://example.org") .allowed_origin("https://example.org")
.allowed_methods(vec![Method::GET]) .allowed_methods(vec![Method::GET])
.finish() .finish()
.new_transform(test::ok_service()); .create(test::ok_service());
let req = TestRequest::with_header("Origin", "https://example.com") let req = TestRequest::with_header("Origin", "https://example.com")
.header(header::ACCESS_CONTROL_REQUEST_METHOD, "GET") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "GET")

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-files" name = "ntex-files"
version = "0.1.0" version = "0.2.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Static files support for ntex web." description = "Static files support for ntex web."
readme = "README.md" readme = "README.md"
@ -18,7 +18,7 @@ name = "ntex_files"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "0.5.30" ntex = "0.6.0-alpha.0"
ntex-http = "0.1.8" ntex-http = "0.1.8"
bitflags = "1.3" bitflags = "1.3"
futures = "0.3" futures = "0.3"
@ -32,4 +32,4 @@ percent-encoding = "2.1"
v_htmlescape = "0.14.1" v_htmlescape = "0.14.1"
[dev-dependencies] [dev-dependencies]
ntex = { version = "0.5", features=["tokio", "openssl", "compress"] } ntex = { version = "0.6.0-alpha.0", features=["tokio", "openssl", "compress"] }

View file

@ -404,9 +404,9 @@ where
type Error = Err::Container; type Error = Err::Container;
type Service = FilesService<Err>; type Service = FilesService<Err>;
type InitError = (); type InitError = ();
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>; type Future<'f> = LocalBoxFuture<'f, Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future { fn create(&self, _: ()) -> Self::Future<'_> {
let mut srv = FilesService { let mut srv = FilesService {
directory: self.directory.clone(), directory: self.directory.clone(),
index: self.index.clone(), index: self.index.clone(),
@ -421,7 +421,7 @@ where
if let Some(default) = self.default.as_ref() { if let Some(default) = self.default.as_ref() {
default default
.new_service(()) .create(())
.map(move |result| match result { .map(move |result| match result {
Ok(default) => { Ok(default) => {
srv.default = Some(default); srv.default = Some(default);
@ -458,7 +458,7 @@ where
req: WebRequest<Err>, req: WebRequest<Err>,
) -> Either< ) -> Either<
Ready<Result<WebResponse, Err::Container>>, Ready<Result<WebResponse, Err::Container>>,
LocalBoxFuture<'static, Result<WebResponse, Err::Container>>, LocalBoxFuture<'_, Result<WebResponse, Err::Container>>,
> { > {
log::debug!("Files: Failed to handle {}: {}", req.path(), e); log::debug!("Files: Failed to handle {}: {}", req.path(), e);
if let Some(ref default) = self.default { if let Some(ref default) = self.default {
@ -476,16 +476,12 @@ where
{ {
type Response = WebResponse; type Response = WebResponse;
type Error = Err::Container; type Error = Err::Container;
type Future = Either< type Future<'f> = Either<
Ready<Result<Self::Response, Self::Error>>, Ready<Result<Self::Response, Self::Error>>,
LocalBoxFuture<'static, Result<Self::Response, Self::Error>>, LocalBoxFuture<'f, Result<Self::Response, Self::Error>>,
>; >;
fn poll_ready(&self, _: &mut Context) -> Poll<Result<(), Self::Error>> { fn call(&self, req: WebRequest<Err>) -> Self::Future<'_> {
Poll::Ready(Ok(()))
}
fn call(&self, req: WebRequest<Err>) -> Self::Future {
let is_method_valid = if let Some(guard) = &self.guards { let is_method_valid = if let Some(guard) = &self.guards {
// execute user defined guards // execute user defined guards
(**guard).check(req.head()) (**guard).check(req.head())
@ -1185,7 +1181,7 @@ mod tests {
.default_handler(|req: WebRequest<DefaultError>| { .default_handler(|req: WebRequest<DefaultError>| {
ok(req.into_response(HttpResponse::Ok().body("default content"))) ok(req.into_response(HttpResponse::Ok().body("default content")))
}) })
.new_service(()) .create(())
.await .await
.unwrap(); .unwrap();
let req = TestRequest::with_uri("/missing").to_srv_request(); let req = TestRequest::with_uri("/missing").to_srv_request();

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-identity" name = "ntex-identity"
version = "0.1.0" version = "0.2.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Identity service for ntex web framework." description = "Identity service for ntex web framework."
readme = "README.md" readme = "README.md"
@ -21,7 +21,7 @@ default = ["cookie-policy"]
cookie-policy = ["cookie/secure", "ntex/cookie"] cookie-policy = ["cookie/secure", "ntex/cookie"]
[dependencies] [dependencies]
ntex = "0.5.14" ntex = "0.6.0-alpha.0"
futures = "0.3" futures = "0.3"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"
@ -30,4 +30,4 @@ cookie = { version = "0.16", features = ["private"] }
time = { version = "0.3", default-features = false, features = ["std"] } time = { version = "0.3", default-features = false, features = ["std"] }
[dev-dependencies] [dev-dependencies]
ntex = { version = "0.5", features=["tokio"] } ntex = { version = "0.6.0-alpha.0", features=["tokio"] }

View file

@ -57,7 +57,7 @@ use time::Duration;
use ntex::http::error::HttpError; use ntex::http::error::HttpError;
use ntex::http::header::{self, HeaderValue}; use ntex::http::header::{self, HeaderValue};
use ntex::http::{HttpMessage, Payload}; use ntex::http::{HttpMessage, Payload};
use ntex::service::{Service, Transform}; use ntex::service::{Middleware, Service};
use ntex::util::Extensions; use ntex::util::Extensions;
use ntex::web::{ use ntex::web::{
DefaultError, ErrorRenderer, FromRequest, HttpRequest, WebRequest, WebResponse, DefaultError, ErrorRenderer, FromRequest, HttpRequest, WebRequest, WebResponse,
@ -220,10 +220,10 @@ impl<T> IdentityService<T> {
} }
} }
impl<S, T> Transform<S> for IdentityService<T> { impl<S, T> Middleware<S> for IdentityService<T> {
type Service = IdentityServiceMiddleware<S, T>; type Service = IdentityServiceMiddleware<S, T>;
fn new_transform(&self, service: S) -> Self::Service { fn create(&self, service: S) -> Self::Service {
IdentityServiceMiddleware { backend: self.backend.clone(), service: Rc::new(service) } IdentityServiceMiddleware { backend: self.backend.clone(), service: Rc::new(service) }
} }
} }
@ -243,7 +243,6 @@ impl<S, T> Clone for IdentityServiceMiddleware<S, T> {
impl<S, T, Err> Service<WebRequest<Err>> for IdentityServiceMiddleware<S, T> impl<S, T, Err> Service<WebRequest<Err>> for IdentityServiceMiddleware<S, T>
where where
S: Service<WebRequest<Err>, Response = WebResponse> + 'static, S: Service<WebRequest<Err>, Response = WebResponse> + 'static,
S::Future: 'static,
T: IdentityPolicy<Err>, T: IdentityPolicy<Err>,
Err: ErrorRenderer, Err: ErrorRenderer,
Err::Container: From<S::Error>, Err::Container: From<S::Error>,
@ -251,7 +250,7 @@ where
{ {
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>; type Future<'f> = LocalBoxFuture<'f, Result<Self::Response, Self::Error>>;
fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), Self::Error>> { fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx) self.service.poll_ready(cx)
@ -261,7 +260,7 @@ where
self.service.poll_shutdown(cx, is_error) self.service.poll_shutdown(cx, is_error)
} }
fn call(&self, mut req: WebRequest<Err>) -> Self::Future { fn call(&self, mut req: WebRequest<Err>) -> Self::Future<'_> {
let srv = self.service.clone(); let srv = self.service.clone();
let backend = self.backend.clone(); let backend = self.backend.clone();
let fut = self.backend.from_request(&mut req); let fut = self.backend.from_request(&mut req);

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-multipart" name = "ntex-multipart"
version = "0.1.0" version = "0.2.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Multipart support for ntex web framework." description = "Multipart support for ntex web framework."
readme = "README.md" readme = "README.md"
@ -16,7 +16,7 @@ name = "ntex_multipart"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
ntex = "0.5.14" ntex = "0.6.0-alpha.0"
derive_more = "0.99" derive_more = "0.99"
httparse = "1.3" httparse = "1.3"
futures = "0.3" futures = "0.3"
@ -25,4 +25,4 @@ mime = "0.3"
twoway = "0.2" twoway = "0.2"
[dev-dependencies] [dev-dependencies]
ntex = { version = "0.5", features=["tokio"] } ntex = { version = "0.6.0-alpha.0", features=["tokio"] }

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ntex-session" name = "ntex-session"
version = "0.1.0" version = "0.2.0"
authors = ["ntex contributors <team@ntex.rs>"] authors = ["ntex contributors <team@ntex.rs>"]
description = "Session for ntex web framework." description = "Session for ntex web framework."
readme = "README.md" readme = "README.md"
@ -22,7 +22,7 @@ default = ["cookie-session"]
cookie-session = ["cookie/secure", "ntex/cookie"] cookie-session = ["cookie/secure", "ntex/cookie"]
[dependencies] [dependencies]
ntex = "0.5.14" ntex = "0.6.0-alpha.0"
cookie = "0.16" cookie = "0.16"
derive_more = "0.99" derive_more = "0.99"
futures = "0.3" futures = "0.3"
@ -31,4 +31,4 @@ serde_json = "1.0"
time = { version = "0.3", default-features = false, features = ["std"] } time = { version = "0.3", default-features = false, features = ["std"] }
[dev-dependencies] [dev-dependencies]
ntex = { version = "0.5", features=["tokio"] } ntex = { version = "0.6.0-alpha.0", features=["tokio"] }

View file

@ -15,17 +15,14 @@
//! The constructors take a key as an argument. This is the private key //! The constructors take a key as an argument. This is the private key
//! for cookie session - when this value is changed, all session data is lost. //! for cookie session - when this value is changed, all session data is lost.
use std::collections::HashMap;
use std::convert::Infallible;
use std::rc::Rc;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use std::{collections::HashMap, convert::Infallible, rc::Rc};
use cookie::{Cookie, CookieJar, Key, SameSite}; use cookie::{Cookie, CookieJar, Key, SameSite};
use derive_more::{Display, From}; use derive_more::{Display, From};
use futures::future::{FutureExt, LocalBoxFuture}; use futures::future::{FutureExt, LocalBoxFuture};
use ntex::http::header::{HeaderValue, SET_COOKIE}; use ntex::http::{header::HeaderValue, header::SET_COOKIE, HttpMessage};
use ntex::http::HttpMessage; use ntex::service::{Middleware, Service};
use ntex::service::{Service, Transform};
use ntex::web::{DefaultError, ErrorRenderer, WebRequest, WebResponse, WebResponseError}; use ntex::web::{DefaultError, ErrorRenderer, WebRequest, WebResponse, WebResponseError};
use serde_json::error::Error as JsonError; use serde_json::error::Error as JsonError;
use time::{Duration, OffsetDateTime}; use time::{Duration, OffsetDateTime};
@ -281,10 +278,10 @@ impl CookieSession {
} }
} }
impl<S> Transform<S> for CookieSession { impl<S> Middleware<S> for CookieSession {
type Service = CookieSessionMiddleware<S>; type Service = CookieSessionMiddleware<S>;
fn new_transform(&self, service: S) -> Self::Service { fn create(&self, service: S) -> Self::Service {
CookieSessionMiddleware { service, inner: self.0.clone() } CookieSessionMiddleware { service, inner: self.0.clone() }
} }
} }
@ -298,14 +295,13 @@ pub struct CookieSessionMiddleware<S> {
impl<S, Err> Service<WebRequest<Err>> for CookieSessionMiddleware<S> impl<S, Err> Service<WebRequest<Err>> for CookieSessionMiddleware<S>
where where
S: Service<WebRequest<Err>, Response = WebResponse>, S: Service<WebRequest<Err>, Response = WebResponse>,
S::Future: 'static,
S::Error: 'static, S::Error: 'static,
Err: ErrorRenderer, Err: ErrorRenderer,
Err::Container: From<CookieSessionError>, Err::Container: From<CookieSessionError>,
{ {
type Response = WebResponse; type Response = WebResponse;
type Error = S::Error; type Error = S::Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>; type Future<'f> = LocalBoxFuture<'f, Result<Self::Response, Self::Error>> where Self: 'f;
fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), Self::Error>> { fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(cx) self.service.poll_ready(cx)
@ -320,7 +316,7 @@ where
/// session state changes, then set-cookie is returned in response. As /// session state changes, then set-cookie is returned in response. As
/// a user logs out, call session.purge() to set SessionStatus accordingly /// a user logs out, call session.purge() to set SessionStatus accordingly
/// and this will trigger removal of the session cookie in the response. /// and this will trigger removal of the session cookie in the response.
fn call(&self, req: WebRequest<Err>) -> Self::Future { fn call(&self, req: WebRequest<Err>) -> Self::Future<'_> {
let inner = self.inner.clone(); let inner = self.inner.clone();
let (is_new, state) = self.inner.load(&req); let (is_new, state) = self.inner.load(&req);
let prolong_expiration = self.inner.expires_in.is_some(); let prolong_expiration = self.inner.expires_in.is_some();