diff --git a/Cargo.toml b/Cargo.toml index 0b4ad38a6..f473ac554 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ members = [ ] [package.metadata.docs.rs] -features = ["ssl", "tls", "rust-tls"] +features = ["ssl", "tls", "rust-tls"] #, "session"] [features] default = ["brotli", "flate2-c"] @@ -45,6 +45,9 @@ flate2-c = ["flate2/miniz-sys"] # rust backend for flate2 crate flate2-rust = ["flate2/rust_backend"] +# sessions feature, session require "ring" crate and c compiler +# session = ["actix-session"] + # tls tls = ["native-tls", "actix-server/ssl"] @@ -56,10 +59,13 @@ ssl = ["openssl", "actix-server/ssl"] [dependencies] actix-codec = "0.1.0" -actix-service = "0.3.2" -actix-utils = "0.3.1" +#actix-service = "0.3.2" +#actix-utils = "0.3.1" actix-rt = "0.1.0" +actix-service = { git = "https://github.com/actix/actix-net.git" } +actix-utils = { git = "https://github.com/actix/actix-net.git" } + actix-http = { git = "https://github.com/actix/actix-http.git" } actix-router = { git = "https://github.com/actix/actix-net.git" } actix-server = { git = "https://github.com/actix/actix-net.git" } @@ -79,6 +85,9 @@ serde_json = "1.0" serde_urlencoded = "^0.5.3" threadpool = "1.7" +# middlewares +# actix-session = { path="session", optional = true } + # compression brotli2 = { version="^0.3.2", optional = true } flate2 = { version="^1.0.2", optional = true, default-features = false } diff --git a/src/app.rs b/src/app.rs index 8336fcca3..b21645016 100644 --- a/src/app.rs +++ b/src/app.rs @@ -25,7 +25,7 @@ type HttpNewService
= BoxedNewService<(), ServiceRequest
, ServiceResponse,
type BoxedResponse = Box
where
- T: NewService >,
+ T: NewService App
where
P: 'static,
T: NewService<
- Request = ServiceRequest ,
Error = (),
InitError = (),
@@ -197,7 +197,7 @@ where
where
F: FnOnce(Resource ) -> Resource ,
U: NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -230,7 +230,7 @@ where
P,
B,
impl NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -239,12 +239,12 @@ where
where
M: Transform<
AppRouting ,
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
>,
- F: IntoTransform >,
{
let fref = Rc::new(RefCell::new(None));
let endpoint = ApplyTransform::new(mw, AppEntry::new(fref.clone()));
@@ -269,7 +269,7 @@ where
) -> App<
P1,
impl NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -406,7 +405,7 @@ where
where
F: FnOnce(Resource ) -> Resource ,
U: NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -430,12 +429,9 @@ where
pub fn default_resource ) -> R,
- R: IntoNewService,
- U: NewService<
- Request = ServiceRequest ,
- Response = ServiceResponse,
- Error = (),
- > + 'static,
+ R: IntoNewService>,
+ U: NewService ,
- Response = ServiceResponse,
- Error = (),
- > + 'static,
+ F: IntoNewService>,
+ U: NewService ,
+ ServiceRequest ,
Response = ServiceResponse ,
+ ServiceRequest ,
Response = ServiceResponse ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
>,
C: NewService<
- Request = ServiceRequest ,
Error = (),
InitError = (),
>,
{
- fn into_new_service(self) -> AndThenNewService {
default: Option {
- type Request = ServiceRequest ;
+impl {
type Response = ServiceResponse;
type Error = ();
type InitError = ();
@@ -709,8 +702,7 @@ pub struct AppRouting {
default: Option Service for AppRouting {
- type Request = ServiceRequest ;
+impl Service {
type Response = ServiceResponse;
type Error = ();
type Future = Either AppEntry {
}
}
-impl {
- type Request = ServiceRequest ;
+impl {
type Response = ServiceResponse;
type Error = ();
type InitError = ();
@@ -774,9 +765,8 @@ impl {
#[doc(hidden)]
pub struct AppChain;
-impl NewService<()> for AppChain {
- type Request = ServiceRequest >,
+ C: NewService ,
- InitError = (),
- >,
+ C: NewService ;
type Error = C::Error;
type InitError = C::InitError;
@@ -842,11 +826,7 @@ where
#[doc(hidden)]
pub struct AppInitResult ,
- InitError = (),
- >,
+ C: NewService ,
- InitError = (),
- >,
+ C: NewService >,
+ C: Service >,
+ C: Service ;
type Error = C::Error;
type Future = C::Future;
@@ -912,7 +887,7 @@ where
self.chain.poll_ready()
}
- fn call(&mut self, req: Request > Extract {
}
}
-impl > NewService for Extract {
- type Request = ServiceRequest ;
+impl > NewService {
type Response = (T, HttpRequest);
type Error = (Error, ServiceFromRequest );
type InitError = ();
@@ -311,8 +306,7 @@ pub struct ExtractService > {
_t: PhantomData<(P, T)>,
}
-impl > Service for ExtractService {
- type Request = ServiceRequest ;
+impl > Service {
type Response = (T, HttpRequest);
type Error = (Error, ServiceFromRequest );
type Future = ExtractResponse ;
diff --git a/src/middleware/compress.rs b/src/middleware/compress.rs
index b95553cb5..c6f090a68 100644
--- a/src/middleware/compress.rs
+++ b/src/middleware/compress.rs
@@ -36,14 +36,13 @@ impl Default for Compress {
}
}
-impl ;
type Response = ServiceResponse ;
type Response = ServiceResponse ;
type Response = ServiceResponse;
type Error = S::Error;
type InitError = ();
@@ -109,12 +108,11 @@ pub struct DefaultHeadersMiddleware ;
type Response = ServiceResponse;
type Error = S::Error;
type Future = Box Default for Resource {
impl
where
T: NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -187,7 +187,7 @@ where
) -> Resource<
P,
impl NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -196,12 +196,12 @@ where
where
M: Transform<
T::Service,
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
>,
- F: IntoTransform ) -> R,
- R: IntoNewService,
- U: NewService<
- Request = ServiceRequest ,
- Response = ServiceResponse,
- Error = (),
- > + 'static,
+ R: IntoNewService>,
+ U: NewService IntoNewService
+impl IntoNewService
where
T: NewService<
- Request = ServiceRequest ,
+ ServiceRequest ,
Response = ServiceResponse,
Error = (),
InitError = (),
@@ -260,8 +257,7 @@ pub struct ResourceFactory {
default: Rc {
- type Request = ServiceRequest ;
+impl {
type Response = ServiceResponse;
type Error = ();
type InitError = ();
@@ -351,8 +347,7 @@ pub struct ResourceService {
default: Option Service for ResourceService {
- type Request = ServiceRequest ;
+impl Service {
type Response = ServiceResponse;
type Error = ();
type Future = Either<
@@ -396,8 +391,7 @@ impl ResourceEndpoint {
}
}
-impl {
- type Request = ServiceRequest ;
+impl {
type Response = ServiceResponse;
type Error = ();
type InitError = ();
diff --git a/src/route.rs b/src/route.rs
index 72abeb324..42e784881 100644
--- a/src/route.rs
+++ b/src/route.rs
@@ -1,4 +1,5 @@
use std::cell::RefCell;
+use std::marker::PhantomData;
use std::rc::Rc;
use actix_http::{http::Method, Error, Extensions, Response};
@@ -14,7 +15,7 @@ use crate::HttpResponse;
type BoxedRouteService {
}
}
-impl NewService for Route {
- type Request = ServiceRequest ;
+impl NewService {
type Response = ServiceResponse;
type Error = ();
type InitError = ();
@@ -141,8 +141,7 @@ impl RouteService {
}
}
-impl Service for RouteService {
- type Request = ServiceRequest ;
+impl Service {
type Response = ServiceResponse;
type Error = ();
type Future = Box Service for RouteService {
self.service.poll_ready()
}
- fn call(&mut self, req: Self::Request) -> Self::Future {
+ fn call(&mut self, req: ServiceRequest ) -> Self::Future {
self.service.call(req)
}
}
@@ -348,43 +347,46 @@ impl {
struct RouteNewService
where
- T: NewService )>,
+ T: NewService )>,
{
service: T,
+ _t: PhantomData ,
}
impl`
pub struct AppInitService Transform for Compress
+impl Transform> for Compress
where
P: 'static,
B: MessageBody,
- S: Service {
encoding: ContentEncoding,
}
-impl Service for CompressMiddleware
+impl Service
where
P: 'static,
B: MessageBody,
- S: Service;
@@ -103,7 +101,7 @@ pub struct CompressResponse
where
P: 'static,
B: MessageBody,
- S: Service Future for CompressResponse
where
P: 'static,
B: MessageBody,
- S: Service Transform for DefaultHeaders
+impl Transform> for DefaultHeaders
where
- S: Service {
inner: Rc Service for DefaultHeadersMiddleware
+impl Service
where
- S: Service