From 9a80911b9280f693ac9f7751ad8e834510d54c02 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 30 Mar 2019 09:12:42 -0700 Subject: [PATCH] update to alpha2 --- Cargo.toml | 8 ++--- actix_redis/Cargo.toml | 2 +- actix_todo/Cargo.toml | 4 +-- async_db/Cargo.toml | 2 +- async_ex1/Cargo.toml | 2 +- basics/Cargo.toml | 4 +-- cookie-auth/Cargo.toml | 2 +- cookie-session/Cargo.toml | 4 +-- diesel/Cargo.toml | 2 +- error_handling/Cargo.toml | 2 +- form/Cargo.toml | 2 +- hello-world/Cargo.toml | 2 +- http-full-proxy/Cargo.toml | 2 +- http-proxy/Cargo.toml | 2 +- json/Cargo.toml | 2 +- juniper/Cargo.toml | 2 +- middleware/Cargo.toml | 2 +- multipart/Cargo.toml | 3 +- protobuf/Cargo.toml | 11 ++++--- protobuf/src/main.rs | 38 +++++++----------------- protobuf/src/protobuf.rs | 47 ++++++++++++----------------- r2d2/Cargo.toml | 2 +- redis-session/Cargo.toml | 4 +-- rustls/Cargo.toml | 9 +++--- rustls/src/main.rs | 54 +++++++++++----------------------- simple-auth-server/Cargo.toml | 3 +- simple-auth-server/src/main.rs | 5 +++- state/Cargo.toml | 2 +- static_index/Cargo.toml | 2 +- template_askama/Cargo.toml | 2 +- template_tera/Cargo.toml | 2 +- template_yarte/Cargo.toml | 2 +- tls/Cargo.toml | 2 +- web-cors/backend/Cargo.toml | 2 +- websocket-chat/Cargo.toml | 4 +-- websocket-chat/src/main.rs | 1 + websocket-tcp-chat/Cargo.toml | 4 +-- websocket-tcp-chat/src/main.rs | 1 + websocket/Cargo.toml | 6 ++-- websocket/src/main.rs | 1 + 40 files changed, 106 insertions(+), 147 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7422c22d..2e79a031 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,18 +21,18 @@ members = [ "protobuf", "r2d2", "redis-session", - "simple-auth-server", + "rustls", + #"simple-auth-server", "state", "static_index", "template_askama", "template_tera", "template_yarte", "tls", - "rustls", - "unix-socket", + #"unix-socket", "web-cors/backend", "websocket", "websocket-chat", - "websocket-chat-broker", + #"websocket-chat-broker", "websocket-tcp-chat", ] diff --git a/actix_redis/Cargo.toml b/actix_redis/Cargo.toml index b8014247..7c762a61 100644 --- a/actix_redis/Cargo.toml +++ b/actix_redis/Cargo.toml @@ -7,7 +7,7 @@ workspace = ".." [dependencies] actix = "0.8.0-alpha.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" actix-redis = { git="https://github.com/actix/actix-redis.git" } futures = "0.1.23" redis-async = "0.4.0" diff --git a/actix_todo/Cargo.toml b/actix_todo/Cargo.toml index 17a35307..52551f0f 100644 --- a/actix_todo/Cargo.toml +++ b/actix_todo/Cargo.toml @@ -6,9 +6,9 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" -actix-session = "0.1.0-alpha.1" +actix-session = "0.1.0-alpha.2" dotenv = "0.13.0" env_logger = "0.5.10" futures = "0.1.22" diff --git a/async_db/Cargo.toml b/async_db/Cargo.toml index 2d322de3..3ccfbc26 100644 --- a/async_db/Cargo.toml +++ b/async_db/Cargo.toml @@ -7,7 +7,7 @@ workspace = ".." [dependencies] actix-rt = "0.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" dotenv = "0.10" env_logger = "0.5" diff --git a/async_ex1/Cargo.toml b/async_ex1/Cargo.toml index 1be43ae9..62154f4b 100644 --- a/async_ex1/Cargo.toml +++ b/async_ex1/Cargo.toml @@ -7,7 +7,7 @@ workspace = ".." [dependencies] actix-rt = "0.2" -actix-web = { version="1.0.0-alpha.1", features=["ssl"] } +actix-web = { version="1.0.0-alpha.2", features=["ssl"] } futures = "0.1" serde = "1.0.43" diff --git a/basics/Cargo.toml b/basics/Cargo.toml index 64c08aa1..4c2dc1e6 100644 --- a/basics/Cargo.toml +++ b/basics/Cargo.toml @@ -7,9 +7,9 @@ edition = "2018" [dependencies] actix-rt = "0.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" -actix-session = "0.1.0-alpha.1" +actix-session = "0.1.0-alpha.2" futures = "0.1.25" env_logger = "0.5" diff --git a/cookie-auth/Cargo.toml b/cookie-auth/Cargo.toml index d728e3ed..f7cded59 100644 --- a/cookie-auth/Cargo.toml +++ b/cookie-auth/Cargo.toml @@ -6,5 +6,5 @@ edition = "2018" workspace = ".." [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.6" diff --git a/cookie-session/Cargo.toml b/cookie-session/Cargo.toml index ce876957..1655322f 100644 --- a/cookie-session/Cargo.toml +++ b/cookie-session/Cargo.toml @@ -6,8 +6,8 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" -actix-session = "0.1.0-alpha.1" +actix-web = "1.0.0-alpha.2" +actix-session = "0.1.0-alpha.2" futures = "0.1" time = "0.1" diff --git a/diesel/Cargo.toml b/diesel/Cargo.toml index d8dfb918..5da09f40 100644 --- a/diesel/Cargo.toml +++ b/diesel/Cargo.toml @@ -6,7 +6,7 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" bytes = "0.4" env_logger = "0.6" diff --git a/error_handling/Cargo.toml b/error_handling/Cargo.toml index 7e05407c..46f2f3e9 100644 --- a/error_handling/Cargo.toml +++ b/error_handling/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" workspace = ".." [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" derive_more = "0.14.0" futures = "0.1.23" diff --git a/form/Cargo.toml b/form/Cargo.toml index 150b9417..7e9eef60 100644 --- a/form/Cargo.toml +++ b/form/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" workspace = ".." [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" serde = "1.0" serde_derive = "1.0" diff --git a/hello-world/Cargo.toml b/hello-world/Cargo.toml index 502b1410..b3f23f99 100644 --- a/hello-world/Cargo.toml +++ b/hello-world/Cargo.toml @@ -6,5 +6,5 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.6" diff --git a/http-full-proxy/Cargo.toml b/http-full-proxy/Cargo.toml index f906fdd2..dfa5c50d 100644 --- a/http-full-proxy/Cargo.toml +++ b/http-full-proxy/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] actix-rt = "0.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" clap = "2.32.0" futures = "0.1.25" diff --git a/http-proxy/Cargo.toml b/http-proxy/Cargo.toml index 487d4580..4bdeb424 100644 --- a/http-proxy/Cargo.toml +++ b/http-proxy/Cargo.toml @@ -15,7 +15,7 @@ path = "src/server.rs" [dependencies] actix-rt = "0.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.5" futures = "0.1" diff --git a/json/Cargo.toml b/json/Cargo.toml index 82b525c8..a742d2ab 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -6,7 +6,7 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" bytes = "0.4" futures = "0.1" diff --git a/juniper/Cargo.toml b/juniper/Cargo.toml index ff47263a..14219124 100644 --- a/juniper/Cargo.toml +++ b/juniper/Cargo.toml @@ -6,7 +6,7 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.6" futures = "0.1" serde = "1.0" diff --git a/middleware/Cargo.toml b/middleware/Cargo.toml index c5657087..659dc317 100644 --- a/middleware/Cargo.toml +++ b/middleware/Cargo.toml @@ -7,6 +7,6 @@ workspace = ".." [dependencies] actix-service = "0.3.3" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" futures = "0.1.25" env_logger = "0.6" \ No newline at end of file diff --git a/multipart/Cargo.toml b/multipart/Cargo.toml index 994c80fc..758bfc29 100644 --- a/multipart/Cargo.toml +++ b/multipart/Cargo.toml @@ -10,8 +10,7 @@ name = "multipart" path = "src/main.rs" [dependencies] -#actix-web = "1.0.0-alpha.1" -actix-web = { git="https://github.com/actix/actix-web.git" } +actix-web = "1.0.0-alpha.2" env_logger = "0.6" futures = "0.1.25" diff --git a/protobuf/Cargo.toml b/protobuf/Cargo.toml index 130581e8..39e889f7 100644 --- a/protobuf/Cargo.toml +++ b/protobuf/Cargo.toml @@ -2,16 +2,15 @@ name = "protobuf-example" version = "0.1.0" authors = ["kingxsp "] -workspace = "../" +workspace = ".." +edition = "2018" [dependencies] bytes = "0.4" futures = "0.1" -failure = "0.1" -env_logger = "*" - +env_logger = "0.6" +derive_more = "0.14" prost = "0.2.0" prost-derive = "0.2.0" -actix = "0.7" -actix-web = "0.7" +actix-web = "1.0.0-alpha.2" diff --git a/protobuf/src/main.rs b/protobuf/src/main.rs index 83220301..043fb59d 100644 --- a/protobuf/src/main.rs +++ b/protobuf/src/main.rs @@ -1,19 +1,8 @@ -extern crate actix; -extern crate actix_web; -extern crate bytes; -extern crate futures; -#[macro_use] -extern crate failure; -extern crate env_logger; -extern crate prost; #[macro_use] extern crate prost_derive; -use actix_web::{ - http, middleware, server, App, AsyncResponder, Error, HttpRequest, HttpResponse, -}; +use actix_web::{middleware, web, App, Error, HttpResponse, HttpServer}; use futures::Future; - mod protobuf; use protobuf::ProtoBufResponseBuilder; @@ -26,31 +15,24 @@ pub struct MyObj { } /// This handler uses `ProtoBufMessage` for loading protobuf object. -fn index(req: &HttpRequest) -> Box> { - protobuf::ProtoBufMessage::new(req) +fn index(pl: web::Payload) -> impl Future { + protobuf::ProtoBufMessage::new(pl) .from_err() // convert all errors into `Error` .and_then(|val: MyObj| { println!("model: {:?}", val); Ok(HttpResponse::Ok().protobuf(val)?) // <- send response }) - .responder() } -fn main() { - ::std::env::set_var("RUST_LOG", "actix_web=info"); +fn main() -> std::io::Result<()> { + std::env::set_var("RUST_LOG", "actix_web=info,actix_server=info"); env_logger::init(); - let sys = actix::System::new("protobuf-example"); - server::new(|| { + HttpServer::new(|| { App::new() - .middleware(middleware::Logger::default()) - .resource("/", |r| r.method(http::Method::POST).f(index)) + .wrap(middleware::Logger::default()) + .service(web::resource("/").route(web::post().to_async(index))) }) - .bind("127.0.0.1:8080") - .unwrap() - .shutdown_timeout(1) - .start(); - - println!("Started http server: 127.0.0.1:8080"); - let _ = sys.run(); + .bind("127.0.0.1:8080")? + .run() } diff --git a/protobuf/src/protobuf.rs b/protobuf/src/protobuf.rs index a9c22651..edde6250 100644 --- a/protobuf/src/protobuf.rs +++ b/protobuf/src/protobuf.rs @@ -1,7 +1,8 @@ use bytes::BytesMut; use futures::{Future, Poll, Stream}; -use bytes::IntoBuf; +use bytes::{Bytes, IntoBuf}; +use derive_more::{Display, From}; use prost::DecodeError as ProtoBufDecodeError; use prost::EncodeError as ProtoBufEncodeError; use prost::Message; @@ -9,25 +10,25 @@ use prost::Message; use actix_web::dev::HttpResponseBuilder; use actix_web::error::{Error, PayloadError, ResponseError}; use actix_web::http::header::CONTENT_TYPE; -use actix_web::{HttpMessage, HttpRequest, HttpResponse, Responder}; +use actix_web::{HttpRequest, HttpResponse, Responder}; -#[derive(Fail, Debug)] +#[derive(Debug, Display, From)] pub enum ProtoBufPayloadError { /// Payload size is bigger than 256k - #[fail(display = "Payload size is bigger than 256k")] + #[display(fmt = "Payload size is bigger than 256k")] Overflow, /// Content type error - #[fail(display = "Content type error")] + #[display(fmt = "Content type error")] ContentType, /// Serialize error - #[fail(display = "ProtoBud serialize error: {}", _0)] - Serialize(#[cause] ProtoBufEncodeError), + #[display(fmt = "ProtoBud serialize error: {}", _0)] + Serialize(ProtoBufEncodeError), /// Deserialize error - #[fail(display = "ProtoBud deserialize error: {}", _0)] - Deserialize(#[cause] ProtoBufDecodeError), + #[display(fmt = "ProtoBud deserialize error: {}", _0)] + Deserialize(ProtoBufDecodeError), /// Payload error - #[fail(display = "Error that occur during reading payload: {}", _0)] - Payload(#[cause] PayloadError), + #[display(fmt = "Error that occur during reading payload: {}", _0)] + Payload(PayloadError), } impl ResponseError for ProtoBufPayloadError { @@ -39,26 +40,14 @@ impl ResponseError for ProtoBufPayloadError { } } -impl From for ProtoBufPayloadError { - fn from(err: PayloadError) -> ProtoBufPayloadError { - ProtoBufPayloadError::Payload(err) - } -} - -impl From for ProtoBufPayloadError { - fn from(err: ProtoBufDecodeError) -> ProtoBufPayloadError { - ProtoBufPayloadError::Deserialize(err) - } -} - #[derive(Debug)] pub struct ProtoBuf(pub T); impl Responder for ProtoBuf { - type Item = HttpResponse; type Error = Error; + type Future = Result; - fn respond_to(self, _: &HttpRequest) -> Result { + fn respond_to(self, _: &HttpRequest) -> Result { let mut buf = Vec::new(); self.0 .encode(&mut buf) @@ -78,9 +67,11 @@ pub struct ProtoBufMessage { impl ProtoBufMessage { /// Create `ProtoBufMessage` for request. - pub fn new(req: &HttpRequest) -> Self { - let fut = req - .payload() + pub fn new(pl: S) -> Self + where + S: Stream + 'static, + { + let fut = pl .map_err(|e| ProtoBufPayloadError::Payload(e)) .fold(BytesMut::new(), move |mut body, chunk| { body.extend_from_slice(&chunk); diff --git a/r2d2/Cargo.toml b/r2d2/Cargo.toml index 0f6d7b57..1fbebaf6 100644 --- a/r2d2/Cargo.toml +++ b/r2d2/Cargo.toml @@ -7,7 +7,7 @@ workspace = ".." [dependencies] actix-rt = "0.2" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" futures = "0.1" env_logger = "0.6" diff --git a/redis-session/Cargo.toml b/redis-session/Cargo.toml index 5198d902..33c4e09a 100644 --- a/redis-session/Cargo.toml +++ b/redis-session/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] actix = "0.8.0-alpha.2" -actix-web = "1.0.0-alpha.1" -actix-session = "0.1.0-alpha.1" +actix-web = "1.0.0-alpha.2" +actix-session = "0.1.0-alpha.2" actix-redis = { git = "https://github.com/actix/actix-redis.git", features = ["web"] } env_logger = "0.6" diff --git a/rustls/Cargo.toml b/rustls/Cargo.toml index 477cb3d2..665ba2c4 100644 --- a/rustls/Cargo.toml +++ b/rustls/Cargo.toml @@ -2,7 +2,8 @@ name = "rustls-example" version = "0.1.0" authors = ["Nikolay Kim "] -workspace = "../" +workspace = ".." +edition = "2018" [[bin]] name = "rustls-server" @@ -10,6 +11,6 @@ path = "src/main.rs" [dependencies] env_logger = "0.5" -rustls = "0.14" -actix = "0.7" -actix-web = { version = "0.7", features=["rust-tls"] } +rustls = "0.15" +actix-web = { version = "1.0.0-alpha.2", features=["rust-tls"] } +actix-files = "0.1.0-alpha.1" diff --git a/rustls/src/main.rs b/rustls/src/main.rs index 33bcb538..8ef45663 100644 --- a/rustls/src/main.rs +++ b/rustls/src/main.rs @@ -1,32 +1,24 @@ -extern crate actix; -extern crate actix_web; -extern crate env_logger; -extern crate rustls; - use std::fs::File; use std::io::BufReader; -use actix_web::{http, middleware, server, App, Error, HttpRequest, HttpResponse}; +use actix_files::Files; +use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer}; use rustls::internal::pemfile::{certs, rsa_private_keys}; use rustls::{NoClientAuth, ServerConfig}; -use server::ServerFlags; - -use actix_web::fs::StaticFiles; /// simple handle -fn index(req: &HttpRequest) -> Result { +fn index(req: HttpRequest) -> Result { println!("{:?}", req); Ok(HttpResponse::Ok() .content_type("text/plain") .body("Welcome!")) } -fn main() { - if ::std::env::var("RUST_LOG").is_err() { - ::std::env::set_var("RUST_LOG", "actix_web=info"); +fn main() -> std::io::Result<()> { + if std::env::var("RUST_LOG").is_err() { + std::env::set_var("RUST_LOG", "actix_web=info"); } env_logger::init(); - let sys = actix::System::new("ws-example"); // load ssl keys let mut config = ServerConfig::new(NoClientAuth::new()); @@ -36,32 +28,20 @@ fn main() { let mut keys = rsa_private_keys(key_file).unwrap(); config.set_single_cert(cert_chain, keys.remove(0)).unwrap(); - // actix acceptor - let acceptor = server::RustlsAcceptor::with_flags( - config, - ServerFlags::HTTP1 | ServerFlags::HTTP2, - ); - - server::new(|| { + HttpServer::new(|| { App::new() // enable logger - .middleware(middleware::Logger::default()) + .wrap(middleware::Logger::default()) // register simple handler, handle all methods - .resource("/index.html", |r| r.f(index)) + .service(web::resource("/index.html").to(index)) // with path parameters - .resource("/", |r| { - r.method(http::Method::GET).f(|_| { - HttpResponse::Found() - .header("LOCATION", "/index.html") - .finish() - }) - }) - .handler("/static", StaticFiles::new("static").unwrap()) + .service(web::resource("/").route(web::get().to(|| { + HttpResponse::Found() + .header("LOCATION", "/index.html") + .finish() + }))) + .service(Files::new("/static", "static")) }) - .bind_with("127.0.0.1:8443", move || acceptor.clone()) - .unwrap() - .start(); - - println!("Started http server: 127.0.0.1:8443"); - let _ = sys.run(); + .bind_rustls("127.0.0.1:8443", config)? + .run() } diff --git a/simple-auth-server/Cargo.toml b/simple-auth-server/Cargo.toml index 0c6a42be..176cdad6 100644 --- a/simple-auth-server/Cargo.toml +++ b/simple-auth-server/Cargo.toml @@ -7,7 +7,8 @@ workspace = ".." [dependencies] actix = { version = "0.8.0-alpha.2", features = ["http"] } -actix-web = "1.0.0-alpha.1" +actix-rt = "0.2.2" +actix-web = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" bcrypt = "0.2.1" diff --git a/simple-auth-server/src/main.rs b/simple-auth-server/src/main.rs index 90024095..cebfcd04 100644 --- a/simple-auth-server/src/main.rs +++ b/simple-auth-server/src/main.rs @@ -37,6 +37,7 @@ fn main() -> std::io::Result<()> { "simple-auth-server=debug,actix_web=info,actix_server=info", ); env_logger::init(); + let sys = actix_rt::System::new("example"); let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); @@ -93,5 +94,7 @@ fn main() -> std::io::Result<()> { .service(fs::Files::new("/", "./static/").index_file("index.html")) }) .bind("127.0.0.1:3000")? - .run() + .start(); + + sys.run() } diff --git a/state/Cargo.toml b/state/Cargo.toml index 962b35d8..468fa9e7 100644 --- a/state/Cargo.toml +++ b/state/Cargo.toml @@ -6,6 +6,6 @@ workspace = ".." edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" futures = "0.1.25" env_logger = "0.6" diff --git a/static_index/Cargo.toml b/static_index/Cargo.toml index 6ae309a8..7ead93ac 100644 --- a/static_index/Cargo.toml +++ b/static_index/Cargo.toml @@ -9,5 +9,5 @@ edition = "2018" futures = "0.1" env_logger = "0.5" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" diff --git a/template_askama/Cargo.toml b/template_askama/Cargo.toml index d88fed35..d0667be5 100644 --- a/template_askama/Cargo.toml +++ b/template_askama/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] #askama = { version = "0.8", features = ["with-actix-web"] } -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.6" askama = "0.8" diff --git a/template_tera/Cargo.toml b/template_tera/Cargo.toml index 81ecb160..560a9a74 100644 --- a/template_tera/Cargo.toml +++ b/template_tera/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" [dependencies] env_logger = "0.6" tera = "0.11" -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" diff --git a/template_yarte/Cargo.toml b/template_yarte/Cargo.toml index 328052ee..bcc59083 100644 --- a/template_yarte/Cargo.toml +++ b/template_yarte/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" workspace = ".." [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" env_logger = "0.6" yarte = "0.1" diff --git a/tls/Cargo.toml b/tls/Cargo.toml index 6e9be047..35dc8e68 100644 --- a/tls/Cargo.toml +++ b/tls/Cargo.toml @@ -11,6 +11,6 @@ path = "src/main.rs" [dependencies] actix-rt = "0.2" -actix-web = { version="1.0.0-alpha.1", features=["ssl"] } +actix-web = { version="1.0.0-alpha.2", features=["ssl"] } env_logger = "0.6" openssl = { version="0.10" } diff --git a/web-cors/backend/Cargo.toml b/web-cors/backend/Cargo.toml index c50eb197..59f7235f 100644 --- a/web-cors/backend/Cargo.toml +++ b/web-cors/backend/Cargo.toml @@ -6,7 +6,7 @@ workspace = "../../" edition = "2018" [dependencies] -actix-web = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" diff --git a/websocket-chat/Cargo.toml b/websocket-chat/Cargo.toml index 64c7876e..a3601cf6 100644 --- a/websocket-chat/Cargo.toml +++ b/websocket-chat/Cargo.toml @@ -11,8 +11,8 @@ path = "src/main.rs" [dependencies] actix = "0.8.0-alpha.2" -actix-web = "1.0.0-alpha.1" -actix-web-actors = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" +actix-web-actors = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" rand = "0.6" diff --git a/websocket-chat/src/main.rs b/websocket-chat/src/main.rs index 45085f7c..ec7da927 100644 --- a/websocket-chat/src/main.rs +++ b/websocket-chat/src/main.rs @@ -173,6 +173,7 @@ impl StreamHandler for WsChatSession { ws::Message::Close(_) => { ctx.stop(); } + ws::Message::Nop => (), } } } diff --git a/websocket-tcp-chat/Cargo.toml b/websocket-tcp-chat/Cargo.toml index b4a06eb7..ab1fff6c 100644 --- a/websocket-tcp-chat/Cargo.toml +++ b/websocket-tcp-chat/Cargo.toml @@ -15,8 +15,8 @@ path = "src/client.rs" [dependencies] actix = "0.8.0-alpha.2" -actix-web = "1.0.0-alpha.1" -actix-web-actors = "1.0.0-alpha.1" +actix-web = "1.0.0-alpha.2" +actix-web-actors = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" rand = "0.6" diff --git a/websocket-tcp-chat/src/main.rs b/websocket-tcp-chat/src/main.rs index cd96c40b..fe73dc8e 100644 --- a/websocket-tcp-chat/src/main.rs +++ b/websocket-tcp-chat/src/main.rs @@ -180,6 +180,7 @@ impl StreamHandler for WsChatSession { ws::Message::Close(_) => { ctx.stop(); } + ws::Message::Nop => (), } } } diff --git a/websocket/Cargo.toml b/websocket/Cargo.toml index 2ceab26e..523eb74a 100644 --- a/websocket/Cargo.toml +++ b/websocket/Cargo.toml @@ -14,9 +14,9 @@ path = "src/main.rs" #path = "src/client.rs" [dependencies] -actix = "0.8.0-alpha.1" -actix-web = "1.0.0-alpha.1" -actix-web-actors = "1.0.0-alpha.1" +actix = "0.8.0-alpha.2" +actix-web = "1.0.0-alpha.2" +actix-web-actors = "1.0.0-alpha.2" actix-files = "0.1.0-alpha.1" env_logger = "0.6" futures = "0.1" diff --git a/websocket/src/main.rs b/websocket/src/main.rs index 67d57918..b16e3fa3 100644 --- a/websocket/src/main.rs +++ b/websocket/src/main.rs @@ -58,6 +58,7 @@ impl StreamHandler for MyWebSocket { ws::Message::Close(_) => { ctx.stop(); } + ws::Message::Nop => (), } } }