mirror of https://github.com/fafhrd91/actix-web
update deps
This commit is contained in:
parent
0c4b3fcc54
commit
bfe47b2034
|
@ -74,7 +74,7 @@ required-features = ["rustls"]
|
|||
|
||||
[dependencies]
|
||||
actix-codec = "0.4.0-beta.1"
|
||||
actix-macros = "0.1.0"
|
||||
actix-macros = "0.2.0"
|
||||
actix-router = "0.2.4"
|
||||
actix-rt = "2.0.0-beta.2"
|
||||
actix-server = "2.0.0-beta.2"
|
||||
|
@ -137,6 +137,8 @@ actix-server = { git = "https://github.com/actix/actix-net.git" }
|
|||
actix-tls = { git = "https://github.com/actix/actix-net.git" }
|
||||
actix-utils = { git = "https://github.com/actix/actix-net.git" }
|
||||
actix-router = { git = "https://github.com/actix/actix-net.git" }
|
||||
actix-macros = { git = "https://github.com/actix/actix-net" }
|
||||
actix = { git = "https://github.com/actix/actix", branch = "feat/actix-rt-2" }
|
||||
|
||||
[[bench]]
|
||||
name = "server"
|
||||
|
|
|
@ -60,7 +60,7 @@ pub async fn test_server_with_addr<F: ServiceFactory<TcpStream>>(
|
|||
|
||||
// run server in separate thread
|
||||
thread::spawn(move || {
|
||||
let sys = System::new("actix-test-server");
|
||||
let sys = System::new();
|
||||
let local_addr = tcp.local_addr().unwrap();
|
||||
|
||||
let srv = Server::build()
|
||||
|
|
|
@ -43,7 +43,7 @@ actors = ["actix"]
|
|||
actix-service = "2.0.0-beta.3"
|
||||
actix-codec = "0.4.0-beta.1"
|
||||
actix-utils = "3.0.0-beta.1"
|
||||
actix-rt = "2.0.0-beta.2"
|
||||
actix-rt = "2.0.0-beta.3"
|
||||
actix-tls = "3.0.0-beta.2"
|
||||
actix = { version = "0.11.0-beta.1", optional = true }
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ where
|
|||
{
|
||||
if let Some(timeout) = self.config.disconnect_timeout {
|
||||
if let ConnectionType::H1(io) = conn.io {
|
||||
actix_rt::spawn(CloseConnection::new(io, timeout))
|
||||
actix_rt::spawn(CloseConnection::new(io, timeout));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -341,7 +341,7 @@ where
|
|||
if let ConnectionType::H1(io) = io {
|
||||
actix_rt::spawn(CloseConnection::new(
|
||||
io, timeout,
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -373,7 +373,7 @@ where
|
|||
self.acquired -= 1;
|
||||
if let Some(timeout) = self.config.disconnect_timeout {
|
||||
if let ConnectionType::H1(io) = io {
|
||||
actix_rt::spawn(CloseConnection::new(io, timeout))
|
||||
actix_rt::spawn(CloseConnection::new(io, timeout));
|
||||
}
|
||||
}
|
||||
self.check_availability();
|
||||
|
@ -536,7 +536,7 @@ where
|
|||
rx: Some(rx),
|
||||
inner: Some(inner),
|
||||
config,
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,16 +150,6 @@ enum PollResponse {
|
|||
DrainWriteBuf,
|
||||
}
|
||||
|
||||
impl PartialEq for PollResponse {
|
||||
fn eq(&self, other: &PollResponse) -> bool {
|
||||
match self {
|
||||
PollResponse::DrainWriteBuf => matches!(other, PollResponse::DrainWriteBuf),
|
||||
PollResponse::DoNothing => matches!(other, PollResponse::DoNothing),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S, B, X, U> Dispatcher<T, S, B, X, U>
|
||||
where
|
||||
T: AsyncRead + AsyncWrite + Unpin,
|
||||
|
@ -324,9 +314,10 @@ where
|
|||
message: Response<()>,
|
||||
body: ResponseBody<B>,
|
||||
) -> Result<(), DispatchError> {
|
||||
let size = body.size();
|
||||
let mut this = self.project();
|
||||
this.codec
|
||||
.encode(Message::Item((message, body.size())), &mut this.write_buf)
|
||||
.encode(Message::Item((message, size)), &mut this.write_buf)
|
||||
.map_err(|err| {
|
||||
if let Some(mut payload) = this.payload.take() {
|
||||
payload.set_error(PayloadError::Incomplete(None));
|
||||
|
@ -335,7 +326,7 @@ where
|
|||
})?;
|
||||
|
||||
this.flags.set(Flags::KEEPALIVE, this.codec.keepalive());
|
||||
match body.size() {
|
||||
match size {
|
||||
BodySize::None | BodySize::Empty => this.state.set(State::None),
|
||||
_ => this.state.set(State::SendPayload(body)),
|
||||
};
|
||||
|
@ -462,28 +453,28 @@ where
|
|||
req: Request,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Result<(), DispatchError> {
|
||||
let mut this = self.as_mut().project();
|
||||
|
||||
// Handle `EXPECT: 100-Continue` header
|
||||
if req.head().expect() {
|
||||
// set dispatcher state so the future is pinned.
|
||||
let mut this = self.as_mut().project();
|
||||
let task = this.flow.expect.call(req);
|
||||
this.state.set(State::ExpectCall(task));
|
||||
} else {
|
||||
// the same as above.
|
||||
let mut this = self.as_mut().project();
|
||||
let task = this.flow.service.call(req);
|
||||
this.state.set(State::ServiceCall(task));
|
||||
};
|
||||
|
||||
// eagerly poll the future for once(or twice if expect is resolved immediately).
|
||||
loop {
|
||||
match self.as_mut().project().state.project() {
|
||||
match this.state.project() {
|
||||
StateProj::ExpectCall(fut) => {
|
||||
match fut.poll(cx) {
|
||||
// expect is resolved. continue loop and poll the service call branch.
|
||||
Poll::Ready(Ok(req)) => {
|
||||
self.as_mut().send_continue();
|
||||
let mut this = self.as_mut().project();
|
||||
this = self.as_mut().project();
|
||||
let task = this.flow.service.call(req);
|
||||
this.state.set(State::ServiceCall(task));
|
||||
continue;
|
||||
|
@ -793,11 +784,11 @@ where
|
|||
if remaining < LW_BUFFER_SIZE {
|
||||
inner_p.write_buf.reserve(HW_BUFFER_SIZE - remaining);
|
||||
}
|
||||
let result = inner.as_mut().poll_response(cx)?;
|
||||
let drain = result == PollResponse::DrainWriteBuf;
|
||||
|
||||
// switch to upgrade handler
|
||||
if let PollResponse::Upgrade(req) = result {
|
||||
let drain = match inner.as_mut().poll_response(cx)? {
|
||||
PollResponse::DrainWriteBuf => true,
|
||||
PollResponse::DoNothing => false,
|
||||
PollResponse::Upgrade(req) => {
|
||||
let inner_p = inner.as_mut().project();
|
||||
let mut parts = FramedParts::with_read_buf(
|
||||
inner_p.io.take().unwrap(),
|
||||
|
@ -818,6 +809,7 @@ where
|
|||
.set(DispatcherState::Upgrade(upgrade));
|
||||
return self.poll(cx);
|
||||
}
|
||||
};
|
||||
|
||||
// we didn't get WouldBlock from write operation,
|
||||
// so data get written to kernel completely (macOS)
|
||||
|
|
|
@ -175,7 +175,6 @@ pub fn main(_: TokenStream, item: TokenStream) -> TokenStream {
|
|||
let vis = &input.vis;
|
||||
let sig = &mut input.sig;
|
||||
let body = &input.block;
|
||||
let name = &sig.ident;
|
||||
|
||||
if sig.asyncness.is_none() {
|
||||
return syn::Error::new_spanned(sig.fn_token, "only async fn is supported")
|
||||
|
@ -188,7 +187,7 @@ pub fn main(_: TokenStream, item: TokenStream) -> TokenStream {
|
|||
(quote! {
|
||||
#(#attrs)*
|
||||
#vis #sig {
|
||||
actix_web::rt::System::new(stringify!(#name))
|
||||
actix_web::rt::System::new()
|
||||
.block_on(async move { #body })
|
||||
}
|
||||
})
|
||||
|
|
|
@ -40,7 +40,7 @@ compress = ["actix-http/compress"]
|
|||
actix-codec = "0.4.0-beta.1"
|
||||
actix-service = "2.0.0-beta.3"
|
||||
actix-http = "3.0.0-beta.1"
|
||||
actix-rt = "2.0.0-beta.2"
|
||||
actix-rt = "2.0.0-beta.3"
|
||||
|
||||
base64 = "0.13"
|
||||
bytes = "1"
|
||||
|
@ -58,9 +58,6 @@ open-ssl = { version = "0.10", package = "openssl", optional = true }
|
|||
rust-tls = { version = "0.19.0", package = "rustls", optional = true, features = ["dangerous_configuration"] }
|
||||
|
||||
[dev-dependencies]
|
||||
# TODO: actix is temporary added as dev dep for actix-macro reason.
|
||||
# Can be removed when it does not impact tests.
|
||||
actix = "0.11.0-beta.1"
|
||||
actix-web = { version = "4.0.0-beta.1", features = ["openssl"] }
|
||||
actix-http = { version = "3.0.0-beta.1", features = ["openssl"] }
|
||||
actix-http-test = { version = "3.0.0-beta.1", features = ["openssl"] }
|
||||
|
|
|
@ -21,7 +21,7 @@ use actix_rt::System;
|
|||
use awc::Client;
|
||||
|
||||
fn main() {
|
||||
System::new("test").block_on(async {
|
||||
System::new().block_on(async {
|
||||
let client = Client::default();
|
||||
|
||||
let res = client
|
||||
|
|
|
@ -68,7 +68,7 @@ impl<T: Responder> Responder for OptionResponder<T> {
|
|||
}
|
||||
|
||||
fn future_responder(c: &mut Criterion) {
|
||||
let rt = actix_rt::System::new("test");
|
||||
let rt = actix_rt::System::new();
|
||||
let req = TestRequest::default().to_http_request();
|
||||
|
||||
c.bench_function("future_responder", move |b| {
|
||||
|
@ -91,7 +91,7 @@ fn future_responder(c: &mut Criterion) {
|
|||
}
|
||||
|
||||
fn responder(c: &mut Criterion) {
|
||||
let rt = actix_rt::System::new("test");
|
||||
let rt = actix_rt::System::new();
|
||||
let req = TestRequest::default().to_http_request();
|
||||
c.bench_function("responder", move |b| {
|
||||
b.iter_custom(|_| {
|
||||
|
|
|
@ -29,7 +29,7 @@ const STR: &str = "Hello World Hello World Hello World Hello World Hello World \
|
|||
fn bench_async_burst(c: &mut Criterion) {
|
||||
// We are using System here, since Runtime requires preinitialized tokio
|
||||
// Maybe add to actix_rt docs
|
||||
let rt = actix_rt::System::new("test");
|
||||
let rt = actix_rt::System::new();
|
||||
|
||||
let srv = rt.block_on(async {
|
||||
test::start(|| {
|
||||
|
|
|
@ -25,7 +25,7 @@ pub fn bench_async_service<S>(c: &mut Criterion, srv: S, name: &str)
|
|||
where
|
||||
S: Service<ServiceRequest, Response = ServiceResponse, Error = Error> + 'static,
|
||||
{
|
||||
let rt = actix_rt::System::new("test");
|
||||
let rt = actix_rt::System::new();
|
||||
let srv = Rc::new(RefCell::new(srv));
|
||||
|
||||
let req = TestRequest::default().to_srv_request();
|
||||
|
@ -67,7 +67,7 @@ async fn index(req: ServiceRequest) -> Result<ServiceResponse, Error> {
|
|||
// Sample results on MacBook Pro '14
|
||||
// time: [2.0724 us 2.1345 us 2.2074 us]
|
||||
fn async_web_service(c: &mut Criterion) {
|
||||
let rt = actix_rt::System::new("test");
|
||||
let rt = actix_rt::System::new();
|
||||
let srv = Rc::new(RefCell::new(rt.block_on(init_service(
|
||||
App::new().service(web::service("/").finish(index)),
|
||||
))));
|
||||
|
|
|
@ -57,7 +57,7 @@ impl Default for TrailingSlash {
|
|||
/// ```rust
|
||||
/// use actix_web::{web, middleware, App};
|
||||
///
|
||||
/// # actix_web::rt::System::new("doctest").block_on(async {
|
||||
/// # actix_web::rt::System::new().block_on(async {
|
||||
/// let app = App::new()
|
||||
/// .wrap(middleware::NormalizePath::default())
|
||||
/// .route("/test", web::get().to(|| async { "test" }))
|
||||
|
|
|
@ -667,7 +667,7 @@ where
|
|||
|
||||
// run server in separate thread
|
||||
thread::spawn(move || {
|
||||
let sys = System::new("actix-test-server");
|
||||
let sys = System::new();
|
||||
let tcp = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let local_addr = tcp.local_addr().unwrap();
|
||||
let factory = factory.clone();
|
||||
|
|
|
@ -13,7 +13,7 @@ async fn test_start() {
|
|||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
thread::spawn(move || {
|
||||
let sys = actix_rt::System::new("test");
|
||||
let sys = actix_rt::System::new();
|
||||
|
||||
sys.block_on(async {
|
||||
let srv = HttpServer::new(|| {
|
||||
|
@ -91,7 +91,7 @@ async fn test_start_ssl() {
|
|||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
thread::spawn(move || {
|
||||
let sys = actix_rt::System::new("test");
|
||||
let sys = actix_rt::System::new();
|
||||
let builder = ssl_acceptor().unwrap();
|
||||
|
||||
let srv = HttpServer::new(|| {
|
||||
|
|
Loading…
Reference in New Issue