1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 07:53:00 +01:00

use new new service api

This commit is contained in:
Nikolay Kim 2019-02-22 14:21:35 -08:00
parent 2f89b12f4f
commit b80ee71785
7 changed files with 30 additions and 18 deletions

View File

@ -37,10 +37,18 @@ session = ["cookie/secure"]
ssl = ["openssl", "actix-connector/ssl"] ssl = ["openssl", "actix-connector/ssl"]
[dependencies] [dependencies]
actix-service = "0.2.1" #actix-service = "0.2.1"
actix-codec = "0.1.0" actix-codec = "0.1.0"
actix-connector = "0.2.0" #actix-connector = "0.2.0"
actix-utils = "0.2.2" #actix-utils = "0.2.2"
actix-service = { git = "https://github.com/actix/actix-net" }
actix-connector = { git = "https://github.com/actix/actix-net" }
actix-utils = { git = "https://github.com/actix/actix-net" }
#actix-service = { path = "../actix-net/actix-service" }
#actix-connector = { path = "../actix-net/actix-connector" }
#actix-utils = { path = "../actix-net/actix-utils" }
base64 = "0.10" base64 = "0.10"
backtrace = "0.3" backtrace = "0.3"
@ -78,8 +86,10 @@ openssl = { version="0.10", optional = true }
[dev-dependencies] [dev-dependencies]
actix-rt = "0.1.0" actix-rt = "0.1.0"
actix-server = { version="0.2", features=["ssl"] } actix-server = { git = "https://github.com/actix/actix-net", features=["ssl"] }
actix-connector = { version="0.2.0", features=["ssl"] } #actix-server = { path = "../actix-net/actix-server", features=["ssl"] }
#actix-connector = { path = "../actix-net/actix-connector", features=["ssl"] }
actix-connector = { git = "https://github.com/actix/actix-net", features=["ssl"] }
actix-http-test = { path="test-server", features=["ssl"] } actix-http-test = { path="test-server", features=["ssl"] }
env_logger = "0.6" env_logger = "0.6"
serde_derive = "1.0" serde_derive = "1.0"

View File

@ -67,9 +67,9 @@ where
type Service = H1ServiceHandler<T, S::Service, B>; type Service = H1ServiceHandler<T, S::Service, B>;
type Future = H1ServiceResponse<T, S, B>; type Future = H1ServiceResponse<T, S, B>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
H1ServiceResponse { H1ServiceResponse {
fut: self.srv.new_service(), fut: self.srv.new_service(&()),
cfg: Some(self.cfg.clone()), cfg: Some(self.cfg.clone()),
_t: PhantomData, _t: PhantomData,
} }
@ -309,7 +309,7 @@ where
type Service = OneRequestService<T>; type Service = OneRequestService<T>;
type Future = FutureResult<Self::Service, Self::InitError>; type Future = FutureResult<Self::Service, Self::InitError>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
ok(OneRequestService { ok(OneRequestService {
config: self.config.clone(), config: self.config.clone(),
_t: PhantomData, _t: PhantomData,

View File

@ -70,9 +70,9 @@ where
type Service = H2ServiceHandler<T, S::Service, B>; type Service = H2ServiceHandler<T, S::Service, B>;
type Future = H2ServiceResponse<T, S, B>; type Future = H2ServiceResponse<T, S, B>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
H2ServiceResponse { H2ServiceResponse {
fut: self.srv.new_service(), fut: self.srv.new_service(&()),
cfg: Some(self.cfg.clone()), cfg: Some(self.cfg.clone()),
_t: PhantomData, _t: PhantomData,
} }

View File

@ -34,7 +34,7 @@ where
type Service = SendError<T, R, E>; type Service = SendError<T, R, E>;
type Future = FutureResult<Self::Service, Self::InitError>; type Future = FutureResult<Self::Service, Self::InitError>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
ok(SendError(PhantomData)) ok(SendError(PhantomData))
} }
} }
@ -142,7 +142,7 @@ where
type Service = SendResponse<T, B>; type Service = SendResponse<T, B>;
type Future = FutureResult<Self::Service, Self::InitError>; type Future = FutureResult<Self::Service, Self::InitError>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
ok(SendResponse(PhantomData)) ok(SendResponse(PhantomData))
} }
} }

View File

@ -28,7 +28,7 @@ impl<T> NewService for VerifyWebSockets<T> {
type Service = VerifyWebSockets<T>; type Service = VerifyWebSockets<T>;
type Future = FutureResult<Self::Service, Self::InitError>; type Future = FutureResult<Self::Service, Self::InitError>;
fn new_service(&self) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
ok(VerifyWebSockets { _t: PhantomData }) ok(VerifyWebSockets { _t: PhantomData })
} }
} }

View File

@ -33,12 +33,16 @@ ssl = ["openssl", "actix-http/ssl", "actix-server/ssl"]
[dependencies] [dependencies]
actix-codec = "0.1" actix-codec = "0.1"
actix-service = "0.2.0"
actix-rt = "0.1.0" actix-rt = "0.1.0"
actix-server = "0.2.0"
actix-utils = "0.2.0"
actix-http = { path=".." } actix-http = { path=".." }
#actix-service = "0.2.0"
#actix-server = "0.2.0"
#actix-utils = "0.2.0"
actix-service = { git = "https://github.com/actix/actix-net" }
actix-server = { git = "https://github.com/actix/actix-net" }
actix-utils = { git = "https://github.com/actix/actix-net" }
base64 = "0.10" base64 = "0.10"
bytes = "0.4" bytes = "0.4"
cookie = { version="0.11", features=["percent-encode"] } cookie = { version="0.11", features=["percent-encode"] }

View File

@ -514,7 +514,6 @@ fn test_body_chunked_implicit() {
let body = once::<_, Error>(Ok(Bytes::from_static(STR.as_ref()))); let body = once::<_, Error>(Ok(Bytes::from_static(STR.as_ref())));
ok::<_, ()>(Response::Ok().streaming(body)) ok::<_, ()>(Response::Ok().streaming(body))
}) })
.map(|_| ())
}); });
let req = srv.get().finish().unwrap(); let req = srv.get().finish().unwrap();
@ -537,7 +536,6 @@ fn test_response_http_error_handling() {
.body(STR), .body(STR),
) )
}) })
.map(|_| ())
}); });
let req = srv.get().finish().unwrap(); let req = srv.get().finish().unwrap();