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

export symbols

This commit is contained in:
Nikolay Kim 2018-03-09 13:03:15 -08:00
parent 02dd5375a9
commit caaace82e3
4 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ pub enum ClientConnectorError {
#[fail(display = "{}", _0)] #[fail(display = "{}", _0)]
Connector(#[cause] ConnectorError), Connector(#[cause] ConnectorError),
/// Connecting took too long /// Connection took too long
#[fail(display = "Timeout out while establishing connection")] #[fail(display = "Timeout out while establishing connection")]
Timeout, Timeout,

View File

@ -15,7 +15,7 @@ use ws::mask::apply_mask;
/// A struct representing a `WebSocket` frame. /// A struct representing a `WebSocket` frame.
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct Frame { pub struct Frame {
finished: bool, finished: bool,
opcode: OpCode, opcode: OpCode,
payload: Binary, payload: Binary,
@ -203,15 +203,15 @@ impl Frame {
// try to parse ws frame md from one chunk // try to parse ws frame md from one chunk
let result = match pl.get_chunk()? { let result = match pl.get_chunk()? {
Async::NotReady => return Ok(Async::NotReady), 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(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 { let (idx, finished, opcode, length, mask) = match result {
// we may need to join several chunks // we may need to join several chunks
Async::NotReady => match Frame::read_copy_md(pl, server, max_size)? { Async::NotReady => match Frame::read_copy_md(pl, server, max_size)? {
Async::NotReady => return Ok(Async::NotReady),
Async::Ready(Some(item)) => item, Async::Ready(Some(item)) => item,
Async::NotReady => return Ok(Async::NotReady),
Async::Ready(None) => return Ok(Async::Ready(None)), Async::Ready(None) => return Ok(Async::Ready(None)),
}, },
Async::Ready(item) => item, Async::Ready(item) => item,
@ -226,7 +226,7 @@ impl Frame {
// remove prefix // remove prefix
pl.drop_payload(idx); pl.drop_payload(idx);
// get body // no need for body
if length == 0 { if length == 0 {
return Ok(Async::Ready(Some(Frame { return Ok(Async::Ready(Some(Frame {
finished, opcode, payload: Binary::from("") }))); finished, opcode, payload: Binary::from("") })));

View File

@ -63,8 +63,8 @@ mod context;
mod mask; mod mask;
mod client; mod client;
use self::frame::Frame; pub use self::frame::Frame;
use self::proto::{hash_key, OpCode}; pub use self::proto::OpCode;
pub use self::proto::CloseCode; pub use self::proto::CloseCode;
pub use self::context::WebsocketContext; pub use self::context::WebsocketContext;
pub use self::client::{Client, ClientError, pub use self::client::{Client, ClientError,
@ -248,7 +248,7 @@ pub fn handshake<S>(req: &HttpRequest<S>) -> Result<HttpResponseBuilder, Handsha
} }
let key = { let key = {
let key = req.headers().get(header::SEC_WEBSOCKET_KEY).unwrap(); let key = req.headers().get(header::SEC_WEBSOCKET_KEY).unwrap();
hash_key(key.as_ref()) proto::hash_key(key.as_ref())
}; };
Ok(HttpResponse::build(StatusCode::SWITCHING_PROTOCOLS) Ok(HttpResponse::build(StatusCode::SWITCHING_PROTOCOLS)

View File

@ -6,7 +6,7 @@ use base64;
use self::OpCode::*; use self::OpCode::*;
/// Operation codes as part of rfc6455. /// Operation codes as part of rfc6455.
#[derive(Debug, Eq, PartialEq, Clone, Copy)] #[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub(crate) enum OpCode { pub enum OpCode {
/// Indicates a continuation frame of a fragmented message. /// Indicates a continuation frame of a fragmented message.
Continue, Continue,
/// Indicates a text data frame. /// Indicates a text data frame.