diff --git a/src/client/connector.rs b/src/client/connector.rs index f5ac70aee..6d649fa6b 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -77,7 +77,7 @@ pub enum ClientConnectorError { #[fail(display = "{}", _0)] Connector(#[cause] ConnectorError), - /// Connecting took too long + /// Connection took too long #[fail(display = "Timeout out while establishing connection")] Timeout, diff --git a/src/ws/frame.rs b/src/ws/frame.rs index 6075d9041..030ae17af 100644 --- a/src/ws/frame.rs +++ b/src/ws/frame.rs @@ -15,7 +15,7 @@ use ws::mask::apply_mask; /// A struct representing a `WebSocket` frame. #[derive(Debug)] -pub(crate) struct Frame { +pub struct Frame { finished: bool, opcode: OpCode, payload: Binary, @@ -203,15 +203,15 @@ impl Frame { // try to parse ws frame md from one chunk let result = match pl.get_chunk()? { Async::NotReady => return Ok(Async::NotReady), - Async::Ready(Some(chunk)) => Frame::read_chunk_md(chunk, server, max_size)?, Async::Ready(None) => return Ok(Async::Ready(None)), + Async::Ready(Some(chunk)) => Frame::read_chunk_md(chunk, server, max_size)?, }; let (idx, finished, opcode, length, mask) = match result { // we may need to join several chunks Async::NotReady => match Frame::read_copy_md(pl, server, max_size)? { - Async::NotReady => return Ok(Async::NotReady), Async::Ready(Some(item)) => item, + Async::NotReady => return Ok(Async::NotReady), Async::Ready(None) => return Ok(Async::Ready(None)), }, Async::Ready(item) => item, @@ -226,7 +226,7 @@ impl Frame { // remove prefix pl.drop_payload(idx); - // get body + // no need for body if length == 0 { return Ok(Async::Ready(Some(Frame { finished, opcode, payload: Binary::from("") }))); diff --git a/src/ws/mod.rs b/src/ws/mod.rs index 6e540527a..12fb4d709 100644 --- a/src/ws/mod.rs +++ b/src/ws/mod.rs @@ -63,8 +63,8 @@ mod context; mod mask; mod client; -use self::frame::Frame; -use self::proto::{hash_key, OpCode}; +pub use self::frame::Frame; +pub use self::proto::OpCode; pub use self::proto::CloseCode; pub use self::context::WebsocketContext; pub use self::client::{Client, ClientError, @@ -248,7 +248,7 @@ pub fn handshake(req: &HttpRequest) -> Result