1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

update actix-service dep

This commit is contained in:
Nikolay Kim 2019-12-22 16:39:25 +04:00
parent f45db1f909
commit c7f3915779
16 changed files with 76 additions and 101 deletions

View File

@ -60,8 +60,8 @@ rustls = ["actix-tls/rustls", "awc/rustls", "rust-tls"]
[dependencies] [dependencies]
actix-codec = "0.2.0" actix-codec = "0.2.0"
actix-service = "1.0.0" actix-service = "1.0.1"
actix-utils = "1.0.3" actix-utils = "1.0.4"
actix-router = "0.2.0" actix-router = "0.2.0"
actix-rt = "1.0.0" actix-rt = "1.0.0"
actix-server = "1.0.0" actix-server = "1.0.0"

View File

@ -18,7 +18,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = "2.0.0-rc" actix-web = "2.0.0-rc"
actix-service = "1.0.0" actix-service = "1.0.1"
derive_more = "0.99.2" derive_more = "0.99.2"
futures = "0.3.1" futures = "0.3.1"

View File

@ -20,7 +20,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "2.0.0-rc", default-features = false } actix-web = { version = "2.0.0-rc", default-features = false }
actix-http = "1.0.1" actix-http = "1.0.1"
actix-service = "1.0.0" actix-service = "1.0.1"
bitflags = "1" bitflags = "1"
bytes = "0.5.3" bytes = "0.5.3"
futures = "0.3.1" futures = "0.3.1"

View File

@ -178,7 +178,9 @@ fn directory_listing(
if dir.is_visible(&entry) { if dir.is_visible(&entry) {
let entry = entry.unwrap(); let entry = entry.unwrap();
let p = match entry.path().strip_prefix(&dir.path) { let p = match entry.path().strip_prefix(&dir.path) {
Ok(p) if cfg!(windows) => base.join(p).to_string_lossy().replace("\\", "/"), Ok(p) if cfg!(windows) => {
base.join(p).to_string_lossy().replace("\\", "/")
}
Ok(p) => base.join(p).to_string_lossy().into_owned(), Ok(p) => base.join(p).to_string_lossy().into_owned(),
Err(_) => continue, Err(_) => continue,
}; };

View File

@ -21,10 +21,10 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-codec = "0.2.0" actix-codec = "0.2.0"
actix-service = "1.0.0" actix-service = "1.0.1"
actix-router = "0.2.0" actix-router = "0.2.0"
actix-rt = "1.0.0" actix-rt = "1.0.0"
actix-http = "1.0.0" actix-http = "1.0.1"
bytes = "0.5.3" bytes = "0.5.3"
futures = "0.3.1" futures = "0.3.1"

View File

@ -40,7 +40,7 @@ failure = ["fail-ure"]
secure-cookies = ["ring"] secure-cookies = ["ring"]
[dependencies] [dependencies]
actix-service = "1.0.0" actix-service = "1.0.1"
actix-codec = "0.2.0" actix-codec = "0.2.0"
actix-connect = "1.0.1" actix-connect = "1.0.1"
actix-utils = "1.0.3" actix-utils = "1.0.3"

View File

@ -18,7 +18,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "2.0.0-rc", default-features = false, features = ["secure-cookies"] } actix-web = { version = "2.0.0-rc", default-features = false, features = ["secure-cookies"] }
actix-service = "1.0.0" actix-service = "1.0.1"
futures = "0.3.1" futures = "0.3.1"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"

View File

@ -17,7 +17,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
actix-web = { version = "2.0.0-rc", default-features = false } actix-web = { version = "2.0.0-rc", default-features = false }
actix-service = "1.0.0" actix-service = "1.0.1"
actix-utils = "1.0.3" actix-utils = "1.0.3"
bytes = "0.5.3" bytes = "0.5.3"
derive_more = "0.99.2" derive_more = "0.99.2"

View File

@ -23,7 +23,7 @@ cookie-session = ["actix-web/secure-cookies"]
[dependencies] [dependencies]
actix-web = "2.0.0-rc" actix-web = "2.0.0-rc"
actix-service = "1.0.0" actix-service = "1.0.1"
bytes = "0.5.3" bytes = "0.5.3"
derive_more = "0.99.2" derive_more = "0.99.2"
futures = "0.3.1" futures = "0.3.1"

View File

@ -35,7 +35,7 @@ compress = ["actix-http/compress"]
[dependencies] [dependencies]
actix-codec = "0.2.0" actix-codec = "0.2.0"
actix-service = "1.0.0" actix-service = "1.0.1"
actix-http = "1.0.0" actix-http = "1.0.0"
actix-rt = "1.0.0" actix-rt = "1.0.0"

View File

@ -172,8 +172,7 @@ async fn test_connection_reuse() {
.and_then( .and_then(
HttpService::new(map_config( HttpService::new(map_config(
App::new() App::new()
.service(web::resource("/").route(web::to(|| HttpResponse::Ok()))) .service(web::resource("/").route(web::to(|| HttpResponse::Ok()))),
.into_factory(),
|_| AppConfig::default(), |_| AppConfig::default(),
)) ))
.tcp(), .tcp(),
@ -210,8 +209,7 @@ async fn test_connection_force_close() {
.and_then( .and_then(
HttpService::new(map_config( HttpService::new(map_config(
App::new() App::new()
.service(web::resource("/").route(web::to(|| HttpResponse::Ok()))) .service(web::resource("/").route(web::to(|| HttpResponse::Ok()))),
.into_factory(),
|_| AppConfig::default(), |_| AppConfig::default(),
)) ))
.tcp(), .tcp(),
@ -239,25 +237,23 @@ async fn test_connection_server_close() {
let num = Arc::new(AtomicUsize::new(0)); let num = Arc::new(AtomicUsize::new(0));
let num2 = num.clone(); let num2 = num.clone();
let srv = let srv = test_server(move || {
test_server(move || { let num2 = num2.clone();
let num2 = num2.clone(); pipeline_factory(move |io| {
pipeline_factory(move |io| { num2.fetch_add(1, Ordering::Relaxed);
num2.fetch_add(1, Ordering::Relaxed); ok(io)
ok(io) })
}) .and_then(
.and_then( HttpService::new(map_config(
HttpService::new(map_config( App::new().service(
App::new() web::resource("/")
.service(web::resource("/").route(web::to(|| { .route(web::to(|| HttpResponse::Ok().force_close().finish())),
HttpResponse::Ok().force_close().finish() ),
}))) |_| AppConfig::default(),
.into_factory(), ))
|_| AppConfig::default(), .tcp(),
)) )
.tcp(), });
)
});
let client = awc::Client::default(); let client = awc::Client::default();
@ -288,12 +284,9 @@ async fn test_connection_wait_queue() {
}) })
.and_then( .and_then(
HttpService::new(map_config( HttpService::new(map_config(
App::new() App::new().service(
.service( web::resource("/").route(web::to(|| HttpResponse::Ok().body(STR))),
web::resource("/") ),
.route(web::to(|| HttpResponse::Ok().body(STR))),
)
.into_factory(),
|_| AppConfig::default(), |_| AppConfig::default(),
)) ))
.tcp(), .tcp(),
@ -330,25 +323,23 @@ async fn test_connection_wait_queue_force_close() {
let num = Arc::new(AtomicUsize::new(0)); let num = Arc::new(AtomicUsize::new(0));
let num2 = num.clone(); let num2 = num.clone();
let srv = let srv = test_server(move || {
test_server(move || { let num2 = num2.clone();
let num2 = num2.clone(); pipeline_factory(move |io| {
pipeline_factory(move |io| { num2.fetch_add(1, Ordering::Relaxed);
num2.fetch_add(1, Ordering::Relaxed); ok(io)
ok(io) })
}) .and_then(
.and_then( HttpService::new(map_config(
HttpService::new(map_config( App::new().service(
App::new() web::resource("/")
.service(web::resource("/").route(web::to(|| { .route(web::to(|| HttpResponse::Ok().force_close().body(STR))),
HttpResponse::Ok().force_close().body(STR) ),
}))) |_| AppConfig::default(),
.into_factory(), ))
|_| AppConfig::default(), .tcp(),
)) )
.tcp(), });
)
});
let client = awc::Client::build() let client = awc::Client::build()
.connector(awc::Connector::new().limit(1).finish()) .connector(awc::Connector::new().limit(1).finish())

View File

@ -63,11 +63,9 @@ async fn _test_connection_reuse_h2() {
.and_then( .and_then(
HttpService::build() HttpService::build()
.h2(map_config( .h2(map_config(
App::new() App::new().service(
.service( web::resource("/").route(web::to(|| HttpResponse::Ok())),
web::resource("/").route(web::to(|| HttpResponse::Ok())), ),
)
.into_factory(),
|_| AppConfig::default(), |_| AppConfig::default(),
)) ))
.openssl(ssl_acceptor()) .openssl(ssl_acceptor())

View File

@ -45,11 +45,9 @@ async fn test_connection_reuse_h2() {
.and_then( .and_then(
HttpService::build() HttpService::build()
.h2(map_config( .h2(map_config(
App::new() App::new().service(
.service( web::resource("/").route(web::to(|| HttpResponse::Ok())),
web::resource("/").route(web::to(|| HttpResponse::Ok())), ),
)
.into_factory(),
|_| AppConfig::default(), |_| AppConfig::default(),
)) ))
.openssl(ssl_acceptor()) .openssl(ssl_acceptor())

View File

@ -2,13 +2,9 @@ use std::marker::PhantomData;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::{fmt, io, net}; use std::{fmt, io, net};
use actix_http::{ use actix_http::{body::MessageBody, Error, HttpService, KeepAlive, Request, Response};
body::MessageBody, Error, HttpService, KeepAlive, Request, Response,
};
use actix_server::{Server, ServerBuilder}; use actix_server::{Server, ServerBuilder};
use actix_service::{ use actix_service::{map_config, IntoServiceFactory, Service, ServiceFactory};
map_config, IntoServiceFactory, Service, ServiceFactory,
};
use net2::TcpBuilder; use net2::TcpBuilder;
@ -266,7 +262,7 @@ where
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.local_addr(addr) .local_addr(addr)
.finish(map_config(factory().into_factory(), move |_| cfg.clone())) .finish(map_config(factory(), move |_| cfg.clone()))
.tcp() .tcp()
}, },
)?; )?;
@ -313,7 +309,7 @@ where
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.client_disconnect(c.client_shutdown) .client_disconnect(c.client_shutdown)
.finish(map_config(factory().into_factory(), move |_| cfg.clone())) .finish(map_config(factory(), move |_| cfg.clone()))
.openssl(acceptor.clone()) .openssl(acceptor.clone())
}, },
)?; )?;
@ -360,7 +356,7 @@ where
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.client_disconnect(c.client_shutdown) .client_disconnect(c.client_shutdown)
.finish(map_config(factory().into_factory(), move |_| cfg.clone())) .finish(map_config(factory(), move |_| cfg.clone()))
.rustls(config.clone()) .rustls(config.clone())
}, },
)?; )?;
@ -483,9 +479,7 @@ where
HttpService::build() HttpService::build()
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.finish(map_config(factory().into_factory(), move |_| { .finish(map_config(factory(), move |_| config.clone())),
config.clone()
})),
) )
})?; })?;
Ok(self) Ok(self)
@ -527,9 +521,7 @@ where
HttpService::build() HttpService::build()
.keep_alive(c.keep_alive) .keep_alive(c.keep_alive)
.client_timeout(c.client_timeout) .client_timeout(c.client_timeout)
.finish(map_config(factory().into_factory(), move |_| { .finish(map_config(factory(), move |_| config.clone())),
config.clone()
})),
) )
}, },
)?; )?;

View File

@ -634,7 +634,7 @@ where
AppConfig::new(false, local_addr, format!("{}", local_addr)); AppConfig::new(false, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h1(map_config(factory().into_factory(), move |_| cfg.clone())) .h1(map_config(factory(), move |_| cfg.clone()))
.tcp() .tcp()
}), }),
HttpVer::Http2 => builder.listen("test", tcp, move || { HttpVer::Http2 => builder.listen("test", tcp, move || {
@ -642,7 +642,7 @@ where
AppConfig::new(false, local_addr, format!("{}", local_addr)); AppConfig::new(false, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h2(map_config(factory().into_factory(), move |_| cfg.clone())) .h2(map_config(factory(), move |_| cfg.clone()))
.tcp() .tcp()
}), }),
HttpVer::Both => builder.listen("test", tcp, move || { HttpVer::Both => builder.listen("test", tcp, move || {
@ -650,9 +650,7 @@ where
AppConfig::new(false, local_addr, format!("{}", local_addr)); AppConfig::new(false, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.finish(map_config(factory().into_factory(), move |_| { .finish(map_config(factory(), move |_| cfg.clone()))
cfg.clone()
}))
.tcp() .tcp()
}), }),
}, },
@ -663,7 +661,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h1(map_config(factory().into_factory(), move |_| cfg.clone())) .h1(map_config(factory(), move |_| cfg.clone()))
.openssl(acceptor.clone()) .openssl(acceptor.clone())
}), }),
HttpVer::Http2 => builder.listen("test", tcp, move || { HttpVer::Http2 => builder.listen("test", tcp, move || {
@ -671,7 +669,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h2(map_config(factory().into_factory(), move |_| cfg.clone())) .h2(map_config(factory(), move |_| cfg.clone()))
.openssl(acceptor.clone()) .openssl(acceptor.clone())
}), }),
HttpVer::Both => builder.listen("test", tcp, move || { HttpVer::Both => builder.listen("test", tcp, move || {
@ -679,9 +677,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.finish(map_config(factory().into_factory(), move |_| { .finish(map_config(factory(), move |_| cfg.clone()))
cfg.clone()
}))
.openssl(acceptor.clone()) .openssl(acceptor.clone())
}), }),
}, },
@ -692,7 +688,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h1(map_config(factory().into_factory(), move |_| cfg.clone())) .h1(map_config(factory(), move |_| cfg.clone()))
.rustls(config.clone()) .rustls(config.clone())
}), }),
HttpVer::Http2 => builder.listen("test", tcp, move || { HttpVer::Http2 => builder.listen("test", tcp, move || {
@ -700,7 +696,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.h2(map_config(factory().into_factory(), move |_| cfg.clone())) .h2(map_config(factory(), move |_| cfg.clone()))
.rustls(config.clone()) .rustls(config.clone())
}), }),
HttpVer::Both => builder.listen("test", tcp, move || { HttpVer::Both => builder.listen("test", tcp, move || {
@ -708,9 +704,7 @@ where
AppConfig::new(true, local_addr, format!("{}", local_addr)); AppConfig::new(true, local_addr, format!("{}", local_addr));
HttpService::build() HttpService::build()
.client_timeout(ctimeout) .client_timeout(ctimeout)
.finish(map_config(factory().into_factory(), move |_| { .finish(map_config(factory(), move |_| cfg.clone()))
cfg.clone()
}))
.rustls(config.clone()) .rustls(config.clone())
}), }),
}, },

View File

@ -30,7 +30,7 @@ default = []
openssl = ["open-ssl", "awc/openssl"] openssl = ["open-ssl", "awc/openssl"]
[dependencies] [dependencies]
actix-service = "1.0.0" actix-service = "1.0.1"
actix-codec = "0.2.0" actix-codec = "0.2.0"
actix-connect = "1.0.0" actix-connect = "1.0.0"
actix-utils = "1.0.3" actix-utils = "1.0.3"