Skip to content

Commit

Permalink
update actix-net dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed May 12, 2019
1 parent 4066375 commit df08baf
Show file tree
Hide file tree
Showing 43 changed files with 362 additions and 322 deletions.
13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ rust-tls = ["rustls", "actix-server/rust-tls"]

[dependencies]
actix-codec = "0.1.2"
actix-service = "0.3.6"
actix-utils = "0.3.4"
actix-service = "0.4.0"
actix-utils = "0.4.0"
actix-router = "0.1.3"
actix-rt = "0.2.2"
actix-web-codegen = "0.1.0-beta.1"
actix-http = { version = "0.1.5", features=["fail"] }
actix-server = "0.4.3"
actix-server = "0.5.0"
actix-server-config = "0.1.1"
actix-threadpool = "0.1.0"
actix = { version = "0.8.1", features=["http"], optional = true }
Expand Down Expand Up @@ -101,7 +101,7 @@ rustls = { version = "^0.15", optional = true }
[dev-dependencies]
actix-http = { version = "0.1.5", features=["ssl", "brotli", "flate2-zlib"] }
actix-http-test = { version = "0.1.1", features=["ssl"] }
actix-files = { version = "0.1.0-beta.1" }
actix-files = { version = "0.1.0-betsa.1" }
rand = "0.6"
env_logger = "0.6"
serde_derive = "1.0"
Expand All @@ -121,5 +121,8 @@ actix-http-test = { path = "test-server" }
actix-web-codegen = { path = "actix-web-codegen" }
actix-web-actors = { path = "actix-web-actors" }
actix-session = { path = "actix-session" }
actix-files = { path = "actix-files" }
awc = { path = "awc" }

actix-files = { path = "actix-files" }
actix-framed = { path = "actix-framed" }
actix-multipart = { path = "actix-multipart" }
4 changes: 2 additions & 2 deletions actix-files/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-files"
version = "0.1.0-beta.1"
version = "0.1.0-betsa.1"
authors = ["Nikolay Kim <[email protected]>"]
description = "Static files support for actix web."
readme = "README.md"
Expand All @@ -19,7 +19,7 @@ path = "src/lib.rs"

[dependencies]
actix-web = "1.0.0-beta.1"
actix-service = "0.3.4"
actix-service = "0.4.0"
bitflags = "1"
bytes = "0.4"
futures = "0.1.25"
Expand Down
2 changes: 2 additions & 0 deletions actix-files/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ impl Files {
where
F: IntoNewService<U>,
U: NewService<
Config = (),
Request = ServiceRequest,
Response = ServiceResponse,
Error = Error,
Expand Down Expand Up @@ -363,6 +364,7 @@ impl HttpServiceFactory for Files {
}

impl NewService for Files {
type Config = ();
type Request = ServiceRequest;
type Response = ServiceResponse;
type Error = Error;
Expand Down
5 changes: 3 additions & 2 deletions actix-framed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ path = "src/lib.rs"

[dependencies]
actix-codec = "0.1.2"
actix-service = "0.3.6"
actix-utils = "0.3.4"
actix-service = "0.4.0"
actix-utils = "0.4.0"
actix-router = "0.1.2"
actix-rt = "0.2.2"
actix-http = "0.1.0"
actix-server-config = "0.1.1"

bytes = "0.4"
futures = "0.1.25"
Expand Down
7 changes: 5 additions & 2 deletions actix-framed/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_http::h1::{Codec, SendResponse};
use actix_http::{Error, Request, Response};
use actix_router::{Path, Router, Url};
use actix_server_config::ServerConfig;
use actix_service::{IntoNewService, NewService, Service};
use actix_utils::cloneable::CloneableService;
use futures::{Async, Future, Poll};
Expand Down Expand Up @@ -49,6 +50,7 @@ impl<T: 'static, S: 'static> FramedApp<T, S> {
where
U: HttpServiceFactory,
U::Factory: NewService<
Config = (),
Request = FramedRequest<T, S>,
Response = (),
Error = Error,
Expand Down Expand Up @@ -88,19 +90,20 @@ pub struct FramedAppFactory<T, S> {
services: Rc<Vec<(String, BoxedHttpNewService<FramedRequest<T, S>>)>>,
}

impl<T, S, C> NewService<C> for FramedAppFactory<T, S>
impl<T, S> NewService for FramedAppFactory<T, S>
where
T: AsyncRead + AsyncWrite + 'static,
S: 'static,
{
type Config = ServerConfig;
type Request = (Request, Framed<T, Codec>);
type Response = ();
type Error = Error;
type InitError = ();
type Service = CloneableService<FramedAppService<T, S>>;
type Future = CreateService<T, S>;

fn new_service(&self, _: &C) -> Self::Future {
fn new_service(&self, _: &ServerConfig) -> Self::Future {
CreateService {
fut: self
.services
Expand Down
4 changes: 3 additions & 1 deletion actix-framed/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub(crate) type BoxedHttpService<Req> = Box<

pub(crate) type BoxedHttpNewService<Req> = Box<
NewService<
Config = (),
Request = Req,
Response = (),
Error = Error,
Expand All @@ -39,12 +40,13 @@ where

impl<T> NewService for HttpNewService<T>
where
T: NewService<Response = (), Error = Error>,
T: NewService<Config = (), Response = (), Error = Error>,
T::Request: 'static,
T::Future: 'static,
T::Service: Service<Future = Box<Future<Item = (), Error = Error>>> + 'static,
<T::Service as Service>::Future: 'static,
{
type Config = ();
type Request = T::Request;
type Response = ();
type Error = Error;
Expand Down
1 change: 1 addition & 0 deletions actix-framed/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ where
R::Future: 'static,
R::Error: fmt::Display,
{
type Config = ();
type Request = FramedRequest<Io, S>;
type Response = ();
type Error = Error;
Expand Down
24 changes: 13 additions & 11 deletions actix-framed/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@ use futures::{Async, Future, IntoFuture, Poll, Sink};

/// Service that verifies incoming request if it is valid websocket
/// upgrade request. In case of error returns `HandshakeError`
pub struct VerifyWebSockets<T> {
_t: PhantomData<T>,
pub struct VerifyWebSockets<T, C> {
_t: PhantomData<(T, C)>,
}

impl<T> Default for VerifyWebSockets<T> {
impl<T, C> Default for VerifyWebSockets<T, C> {
fn default() -> Self {
VerifyWebSockets { _t: PhantomData }
}
}

impl<T, C> NewService<C> for VerifyWebSockets<T> {
impl<T, C> NewService for VerifyWebSockets<T, C> {
type Config = C;
type Request = (Request, Framed<T, Codec>);
type Response = (Request, Framed<T, Codec>);
type Error = (HandshakeError, Framed<T, Codec>);
type InitError = ();
type Service = VerifyWebSockets<T>;
type Service = VerifyWebSockets<T, C>;
type Future = FutureResult<Self::Service, Self::InitError>;

fn new_service(&self, _: &C) -> Self::Future {
ok(VerifyWebSockets { _t: PhantomData })
}
}

impl<T> Service for VerifyWebSockets<T> {
impl<T, C> Service for VerifyWebSockets<T, C> {
type Request = (Request, Framed<T, Codec>);
type Response = (Request, Framed<T, Codec>);
type Error = (HandshakeError, Framed<T, Codec>);
Expand All @@ -54,9 +55,9 @@ impl<T> Service for VerifyWebSockets<T> {
}

/// Send http/1 error response
pub struct SendError<T, R, E>(PhantomData<(T, R, E)>);
pub struct SendError<T, R, E, C>(PhantomData<(T, R, E, C)>);

impl<T, R, E> Default for SendError<T, R, E>
impl<T, R, E, C> Default for SendError<T, R, E, C>
where
T: AsyncRead + AsyncWrite,
E: ResponseError,
Expand All @@ -66,25 +67,26 @@ where
}
}

impl<T, R, E, C> NewService<C> for SendError<T, R, E>
impl<T, R, E, C> NewService for SendError<T, R, E, C>
where
T: AsyncRead + AsyncWrite + 'static,
R: 'static,
E: ResponseError + 'static,
{
type Config = C;
type Request = Result<R, (E, Framed<T, Codec>)>;
type Response = R;
type Error = (E, Framed<T, Codec>);
type InitError = ();
type Service = SendError<T, R, E>;
type Service = SendError<T, R, E, C>;
type Future = FutureResult<Self::Service, Self::InitError>;

fn new_service(&self, _: &C) -> Self::Future {
ok(SendError(PhantomData))
}
}

impl<T, R, E> Service for SendError<T, R, E>
impl<T, R, E, C> Service for SendError<T, R, E, C>
where
T: AsyncRead + AsyncWrite + 'static,
R: 'static,
Expand Down
9 changes: 9 additions & 0 deletions actix-http/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changes

## [0.2.0] - 2019-xx-xx

### Changed

* Update actix-service to 0.4

* Expect and upgrade services accept `ServerConfig` config.


## [0.1.5] - 2019-05-04

### Fixed
Expand Down
10 changes: 5 additions & 5 deletions actix-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ fail = ["failure"]
secure-cookies = ["ring"]

[dependencies]
actix-service = "0.3.6"
actix-service = "0.4.0"
actix-codec = "0.1.2"
actix-connect = "0.1.5"
actix-utils = "0.3.5"
actix-connect = "0.2.0"
actix-utils = "0.4.0"
actix-server-config = "0.1.1"
actix-threadpool = "0.1.0"

Expand Down Expand Up @@ -97,8 +97,8 @@ chrono = "0.4.6"

[dev-dependencies]
actix-rt = "0.2.2"
actix-server = { version = "0.4.3", features=["ssl"] }
actix-connect = { version = "0.1.4", features=["ssl"] }
actix-server = { version = "0.5.0", features=["ssl"] }
actix-connect = { version = "0.2.0", features=["ssl"] }
actix-http-test = { version = "0.1.0", features=["ssl"] }
env_logger = "0.6"
serde_derive = "1.0"
Expand Down
26 changes: 17 additions & 9 deletions actix-http/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct HttpServiceBuilder<T, S, X = ExpectHandler, U = UpgradeHandler<T>> {

impl<T, S> HttpServiceBuilder<T, S, ExpectHandler, UpgradeHandler<T>>
where
S: NewService<SrvConfig, Request = Request>,
S: NewService<Config = SrvConfig, Request = Request>,
S::Error: Into<Error>,
S::InitError: fmt::Debug,
{
Expand All @@ -48,13 +48,17 @@ where

impl<T, S, X, U> HttpServiceBuilder<T, S, X, U>
where
S: NewService<SrvConfig, Request = Request>,
S: NewService<Config = SrvConfig, Request = Request>,
S::Error: Into<Error>,
S::InitError: fmt::Debug,
X: NewService<Request = Request, Response = Request>,
X: NewService<Config = SrvConfig, Request = Request, Response = Request>,
X::Error: Into<Error>,
X::InitError: fmt::Debug,
U: NewService<Request = (Request, Framed<T, Codec>), Response = ()>,
U: NewService<
Config = SrvConfig,
Request = (Request, Framed<T, Codec>),
Response = (),
>,
U::Error: fmt::Display,
U::InitError: fmt::Debug,
{
Expand Down Expand Up @@ -101,7 +105,7 @@ where
pub fn expect<F, X1>(self, expect: F) -> HttpServiceBuilder<T, S, X1, U>
where
F: IntoNewService<X1>,
X1: NewService<Request = Request, Response = Request>,
X1: NewService<Config = SrvConfig, Request = Request, Response = Request>,
X1::Error: Into<Error>,
X1::InitError: fmt::Debug,
{
Expand All @@ -122,7 +126,11 @@ where
pub fn upgrade<F, U1>(self, upgrade: F) -> HttpServiceBuilder<T, S, X, U1>
where
F: IntoNewService<U1>,
U1: NewService<Request = (Request, Framed<T, Codec>), Response = ()>,
U1: NewService<
Config = SrvConfig,
Request = (Request, Framed<T, Codec>),
Response = (),
>,
U1::Error: fmt::Display,
U1::InitError: fmt::Debug,
{
Expand All @@ -140,7 +148,7 @@ where
pub fn h1<F, P, B>(self, service: F) -> H1Service<T, P, S, B, X, U>
where
B: MessageBody + 'static,
F: IntoNewService<S, SrvConfig>,
F: IntoNewService<S>,
S::Error: Into<Error>,
S::InitError: fmt::Debug,
S::Response: Into<Response<B>>,
Expand All @@ -159,7 +167,7 @@ where
pub fn h2<F, P, B>(self, service: F) -> H2Service<T, P, S, B>
where
B: MessageBody + 'static,
F: IntoNewService<S, SrvConfig>,
F: IntoNewService<S>,
S::Error: Into<Error>,
S::InitError: fmt::Debug,
S::Response: Into<Response<B>>,
Expand All @@ -177,7 +185,7 @@ where
pub fn finish<F, P, B>(self, service: F) -> HttpService<T, P, S, B, X, U>
where
B: MessageBody + 'static,
F: IntoNewService<S, SrvConfig>,
F: IntoNewService<S>,
S::Error: Into<Error>,
S::InitError: fmt::Debug,
S::Response: Into<Response<B>>,
Expand Down
4 changes: 3 additions & 1 deletion actix-http/src/h1/expect.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use actix_server_config::ServerConfig;
use actix_service::{NewService, Service};
use futures::future::{ok, FutureResult};
use futures::{Async, Poll};
Expand All @@ -8,14 +9,15 @@ use crate::request::Request;
pub struct ExpectHandler;

impl NewService for ExpectHandler {
type Config = ServerConfig;
type Request = Request;
type Response = Request;
type Error = Error;
type Service = ExpectHandler;
type InitError = Error;
type Future = FutureResult<Self::Service, Self::InitError>;

fn new_service(&self, _: &()) -> Self::Future {
fn new_service(&self, _: &ServerConfig) -> Self::Future {
ok(ExpectHandler)
}
}
Expand Down
Loading

0 comments on commit df08baf

Please sign in to comment.