update ntex

This commit is contained in:
Nikolay Kim 2020-04-12 01:30:50 +06:00
parent bf9bd1825d
commit 6abb5a40df
9 changed files with 41 additions and 59 deletions

View file

@ -22,7 +22,7 @@ default = ["cookie-session"]
cookie-session = ["cookie/secure", "ntex/cookie"]
[dependencies]
ntex = "0.1.7"
ntex = "0.1.8"
bytes = "0.5.4"
cookie = "0.13.3"
derive_more = "0.99.5"

View file

@ -83,9 +83,9 @@ impl<Err> CookieSessionInner<Err> {
}
}
fn set_cookie<B>(
fn set_cookie(
&self,
res: &mut WebResponse<B>,
res: &mut WebResponse,
state: impl Iterator<Item = (String, String)>,
) -> Result<(), CookieSessionError> {
let state: HashMap<String, String> = state.collect();
@ -132,7 +132,7 @@ impl<Err> CookieSessionInner<Err> {
}
/// invalidates session cookie
fn remove_cookie<B>(&self, res: &mut WebResponse<B>) -> Result<(), Infallible> {
fn remove_cookie(&self, res: &mut WebResponse) -> Result<(), Infallible> {
let mut cookie = Cookie::named(self.name.clone());
cookie.set_value("");
cookie.set_max_age(Duration::zero());
@ -294,17 +294,16 @@ impl<Err> CookieSession<Err> {
}
}
impl<S, B, Err> Transform<S> for CookieSession<Err>
impl<S, Err> Transform<S> for CookieSession<Err>
where
S: Service<Request = WebRequest<Err>, Response = WebResponse<B>>,
S: Service<Request = WebRequest<Err>, Response = WebResponse>,
S::Future: 'static,
S::Error: 'static,
B: 'static,
Err: ErrorRenderer,
Err::Container: From<CookieSessionError>,
{
type Request = WebRequest<Err>;
type Response = WebResponse<B>;
type Response = WebResponse;
type Error = S::Error;
type InitError = ();
type Transform = CookieSessionMiddleware<S, Err>;
@ -324,17 +323,16 @@ pub struct CookieSessionMiddleware<S, Err> {
inner: Rc<CookieSessionInner<Err>>,
}
impl<S, B, Err> Service for CookieSessionMiddleware<S, Err>
impl<S, Err> Service for CookieSessionMiddleware<S, Err>
where
S: Service<Request = WebRequest<Err>, Response = WebResponse<B>>,
S: Service<Request = WebRequest<Err>, Response = WebResponse>,
S::Future: 'static,
S::Error: 'static,
B: 'static,
Err: ErrorRenderer,
Err::Container: From<CookieSessionError>,
{
type Request = WebRequest<Err>;
type Response = WebResponse<B>;
type Response = WebResponse;
type Error = S::Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;

View file

@ -188,8 +188,8 @@ impl Session {
inner.state.extend(data);
}
pub fn get_changes<B>(
res: &mut WebResponse<B>,
pub fn get_changes(
res: &mut WebResponse,
) -> (
SessionStatus,
Option<impl Iterator<Item = (String, String)>>,