1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

upgrade to actix-net release

This commit is contained in:
Nikolay Kim
2019-12-11 19:20:20 +06:00
parent ef3a33b9d6
commit 131c897099
16 changed files with 71 additions and 75 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "actix-http"
version = "1.0.0-alpha.5"
version = "1.0.0-alpha.6"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix http primitives"
readme = "README.md"
@ -44,13 +44,13 @@ fail = ["failure"]
secure-cookies = ["ring"]
[dependencies]
actix-service = "1.0.0-alpha.4"
actix-codec = "0.2.0-alpha.3"
actix-connect = "1.0.0-alpha.3"
actix-utils = "1.0.0-alpha.3"
actix-rt = "1.0.0-alpha.3"
actix-service = "1.0.0"
actix-codec = "0.2.0"
actix-connect = "1.0.0"
actix-utils = "1.0.1"
actix-rt = "1.0.0"
actix-threadpool = "0.3.0"
actix-tls = { version = "1.0.0-alpha.3", optional = true }
actix-tls = { version = "1.0.0", optional = true }
base64 = "0.11"
bitflags = "1.0"
@ -92,10 +92,10 @@ flate2 = { version="1.0.7", optional = true, default-features = false }
failure = { version = "0.1.5", optional = true }
[dev-dependencies]
actix-server = { version = "1.0.0-alpha.4" }
actix-connect = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-server = "1.0.0"
actix-connect = { version = "1.0.0", features=["openssl"] }
actix-http-test = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-tls = { version = "1.0.0-alpha.3", features=["openssl"] }
actix-tls = { version = "1.0.0", features=["openssl"] }
env_logger = "0.6"
serde_derive = "1.0"
open-ssl = { version="0.10", package = "openssl" }

View File

@ -4,19 +4,19 @@ use std::task::{Context, Poll};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_service::{IntoService, Service};
use actix_utils::framed::{FramedTransport, FramedTransportError};
use actix_utils::framed;
use super::{Codec, Frame, Message};
pub struct Transport<S, T>
pub struct Dispatcher<S, T>
where
S: Service<Request = Frame, Response = Message> + 'static,
T: AsyncRead + AsyncWrite,
{
inner: FramedTransport<S, T, Codec>,
inner: framed::Dispatcher<S, T, Codec>,
}
impl<S, T> Transport<S, T>
impl<S, T> Dispatcher<S, T>
where
T: AsyncRead + AsyncWrite,
S: Service<Request = Frame, Response = Message>,
@ -24,26 +24,26 @@ where
S::Error: 'static,
{
pub fn new<F: IntoService<S>>(io: T, service: F) -> Self {
Transport {
inner: FramedTransport::new(Framed::new(io, Codec::new()), service),
Dispatcher {
inner: framed::Dispatcher::new(Framed::new(io, Codec::new()), service),
}
}
pub fn with<F: IntoService<S>>(framed: Framed<T, Codec>, service: F) -> Self {
Transport {
inner: FramedTransport::new(framed, service),
Dispatcher {
inner: framed::Dispatcher::new(framed, service),
}
}
}
impl<S, T> Future for Transport<S, T>
impl<S, T> Future for Dispatcher<S, T>
where
T: AsyncRead + AsyncWrite,
S: Service<Request = Frame, Response = Message>,
S::Future: 'static,
S::Error: 'static,
{
type Output = Result<(), FramedTransportError<S::Error, Codec>>;
type Output = Result<(), framed::DispatcherError<S::Error, Codec>>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Pin::new(&mut self.inner).poll(cx)

View File

@ -13,15 +13,15 @@ use crate::message::RequestHead;
use crate::response::{Response, ResponseBuilder};
mod codec;
mod dispatcher;
mod frame;
mod mask;
mod proto;
mod transport;
pub use self::codec::{Codec, Frame, Message};
pub use self::dispatcher::Dispatcher;
pub use self::frame::Parser;
pub use self::proto::{hash_key, CloseCode, CloseReason, OpCode};
pub use self::transport::Transport;
/// Websocket protocol errors
#[derive(Debug, Display, From)]

View File

@ -1,7 +1,7 @@
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_http::{body, h1, ws, Error, HttpService, Request, Response};
use actix_http_test::TestServer;
use actix_utils::framed::FramedTransport;
use actix_utils::framed::Dispatcher;
use bytes::BytesMut;
use futures::future;
use futures::{SinkExt, StreamExt};
@ -16,7 +16,7 @@ async fn ws_service<T: AsyncRead + AsyncWrite + Unpin>(
.await
.unwrap();
FramedTransport::new(framed.into_framed(ws::Codec::new()), service)
Dispatcher::new(framed.into_framed(ws::Codec::new()), service)
.await
.map_err(|_| panic!())
}