mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
clippy warnings
This commit is contained in:
parent
644f1a9518
commit
72aa2d9eae
@ -46,7 +46,7 @@ impl Handler<ws::Message> for MyWebSocket {
|
|||||||
ws::Message::Ping(msg) => ctx.pong(&msg),
|
ws::Message::Ping(msg) => ctx.pong(&msg),
|
||||||
ws::Message::Text(text) => ctx.text(text),
|
ws::Message::Text(text) => ctx.text(text),
|
||||||
ws::Message::Binary(bin) => ctx.binary(bin),
|
ws::Message::Binary(bin) => ctx.binary(bin),
|
||||||
ws::Message::Closed | ws::Message::Error => {
|
ws::Message::Close(_) | ws::Message::Error => {
|
||||||
ctx.stop();
|
ctx.stop();
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -161,10 +161,9 @@ impl Handler<ws::Message> for WsChatSession {
|
|||||||
},
|
},
|
||||||
ws::Message::Binary(bin) =>
|
ws::Message::Binary(bin) =>
|
||||||
println!("Unexpected binary"),
|
println!("Unexpected binary"),
|
||||||
ws::Message::Closed | ws::Message::Error => {
|
ws::Message::Close(_) | ws::Message::Error => {
|
||||||
ctx.stop();
|
ctx.stop();
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ impl Handler<ws::Message> for MyWebSocket {
|
|||||||
ws::Message::Ping(msg) => ctx.pong(&msg),
|
ws::Message::Ping(msg) => ctx.pong(&msg),
|
||||||
ws::Message::Text(text) => ctx.text(text),
|
ws::Message::Text(text) => ctx.text(text),
|
||||||
ws::Message::Binary(bin) => ctx.binary(bin),
|
ws::Message::Binary(bin) => ctx.binary(bin),
|
||||||
ws::Message::Closed | ws::Message::Error => {
|
ws::Message::Close(_) | ws::Message::Error => {
|
||||||
ctx.stop();
|
ctx.stop();
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -149,7 +149,7 @@ impl<S> Application<S> where S: 'static {
|
|||||||
pub fn with_state(state: S) -> Application<S> {
|
pub fn with_state(state: S) -> Application<S> {
|
||||||
Application {
|
Application {
|
||||||
parts: Some(ApplicationParts {
|
parts: Some(ApplicationParts {
|
||||||
state: state,
|
state,
|
||||||
prefix: "/".to_owned(),
|
prefix: "/".to_owned(),
|
||||||
settings: ServerSettings::default(),
|
settings: ServerSettings::default(),
|
||||||
default: Resource::default_not_found(),
|
default: Resource::default_not_found(),
|
||||||
@ -361,17 +361,17 @@ impl<S> Application<S> where S: 'static {
|
|||||||
default: parts.default,
|
default: parts.default,
|
||||||
encoding: parts.encoding,
|
encoding: parts.encoding,
|
||||||
router: router.clone(),
|
router: router.clone(),
|
||||||
resources: resources,
|
|
||||||
handlers: parts.handlers,
|
handlers: parts.handlers,
|
||||||
|
resources,
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
HttpApplication {
|
HttpApplication {
|
||||||
state: Rc::new(parts.state),
|
state: Rc::new(parts.state),
|
||||||
prefix: prefix.to_owned(),
|
prefix: prefix.to_owned(),
|
||||||
inner: inner,
|
|
||||||
router: router.clone(),
|
router: router.clone(),
|
||||||
middlewares: Rc::new(parts.middlewares),
|
middlewares: Rc::new(parts.middlewares),
|
||||||
|
inner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,12 +176,12 @@ impl HttpResponseParser {
|
|||||||
if let Some(decoder) = decoder {
|
if let Some(decoder) = decoder {
|
||||||
Ok(Async::Ready(
|
Ok(Async::Ready(
|
||||||
(ClientResponse::new(
|
(ClientResponse::new(
|
||||||
ClientMessage{status: status, version: version,
|
ClientMessage{status, version,
|
||||||
headers: hdrs, cookies: None}), Some(decoder))))
|
headers: hdrs, cookies: None}), Some(decoder))))
|
||||||
} else {
|
} else {
|
||||||
Ok(Async::Ready(
|
Ok(Async::Ready(
|
||||||
(ClientResponse::new(
|
(ClientResponse::new(
|
||||||
ClientMessage{status: status, version: version,
|
ClientMessage{status, version,
|
||||||
headers: hdrs, cookies: None}), None)))
|
headers: hdrs, cookies: None}), None)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,16 +63,13 @@ impl SendRequest {
|
|||||||
pub(crate) fn with_connector(req: ClientRequest, conn: Addr<Unsync, ClientConnector>)
|
pub(crate) fn with_connector(req: ClientRequest, conn: Addr<Unsync, ClientConnector>)
|
||||||
-> SendRequest
|
-> SendRequest
|
||||||
{
|
{
|
||||||
SendRequest{
|
SendRequest{req, conn, state: State::New}
|
||||||
req: req,
|
|
||||||
state: State::New,
|
|
||||||
conn: conn}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn with_connection(req: ClientRequest, conn: Connection) -> SendRequest
|
pub(crate) fn with_connection(req: ClientRequest, conn: Connection) -> SendRequest
|
||||||
{
|
{
|
||||||
SendRequest{
|
SendRequest{
|
||||||
req: req,
|
req,
|
||||||
state: State::Connection(conn),
|
state: State::Connection(conn),
|
||||||
conn: ClientConnector::from_registry()}
|
conn: ClientConnector::from_registry()}
|
||||||
}
|
}
|
||||||
@ -103,7 +100,7 @@ impl Future for SendRequest {
|
|||||||
Err(_) => return Err(SendRequestError::Connector(
|
Err(_) => return Err(SendRequestError::Connector(
|
||||||
ClientConnectorError::Disconnected))
|
ClientConnectorError::Disconnected))
|
||||||
},
|
},
|
||||||
State::Connection(stream) => {
|
State::Connection(conn) => {
|
||||||
let mut writer = HttpClientWriter::new(SharedBytes::default());
|
let mut writer = HttpClientWriter::new(SharedBytes::default());
|
||||||
writer.start(&mut self.req)?;
|
writer.start(&mut self.req)?;
|
||||||
|
|
||||||
@ -114,9 +111,7 @@ impl Future for SendRequest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut pl = Box::new(Pipeline {
|
let mut pl = Box::new(Pipeline {
|
||||||
body: body,
|
body, conn, writer,
|
||||||
conn: stream,
|
|
||||||
writer: writer,
|
|
||||||
parser: Some(HttpResponseParser::default()),
|
parser: Some(HttpResponseParser::default()),
|
||||||
parser_buf: BytesMut::new(),
|
parser_buf: BytesMut::new(),
|
||||||
disconnected: false,
|
disconnected: false,
|
||||||
@ -221,11 +216,10 @@ impl Pipeline {
|
|||||||
let mut need_run = false;
|
let mut need_run = false;
|
||||||
|
|
||||||
// need write?
|
// need write?
|
||||||
match self.poll_write()
|
if let Async::NotReady = self.poll_write()
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{}", e)))?
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("{}", e)))?
|
||||||
{
|
{
|
||||||
Async::NotReady => need_run = true,
|
need_run = true;
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// need read?
|
// need read?
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::fmt::Write as FmtWrite;
|
use std::fmt::Write as FmtWrite;
|
||||||
@ -48,14 +50,14 @@ pub(crate) struct HttpClientWriter {
|
|||||||
|
|
||||||
impl HttpClientWriter {
|
impl HttpClientWriter {
|
||||||
|
|
||||||
pub fn new(buf: SharedBytes) -> HttpClientWriter {
|
pub fn new(buffer: SharedBytes) -> HttpClientWriter {
|
||||||
let encoder = ContentEncoder::Identity(TransferEncoding::eof(buf.clone()));
|
let encoder = ContentEncoder::Identity(TransferEncoding::eof(buffer.clone()));
|
||||||
HttpClientWriter {
|
HttpClientWriter {
|
||||||
flags: Flags::empty(),
|
flags: Flags::empty(),
|
||||||
written: 0,
|
written: 0,
|
||||||
headers_size: 0,
|
headers_size: 0,
|
||||||
buffer: buf,
|
buffer,
|
||||||
encoder: encoder,
|
encoder,
|
||||||
low: LOW_WATERMARK,
|
low: LOW_WATERMARK,
|
||||||
high: HIGH_WATERMARK,
|
high: HIGH_WATERMARK,
|
||||||
}
|
}
|
||||||
|
@ -230,10 +230,7 @@ pub struct Drain<A> {
|
|||||||
|
|
||||||
impl<A> Drain<A> {
|
impl<A> Drain<A> {
|
||||||
pub fn new(fut: oneshot::Receiver<()>) -> Self {
|
pub fn new(fut: oneshot::Receiver<()>) -> Self {
|
||||||
Drain {
|
Drain { fut, _a: PhantomData }
|
||||||
fut: fut,
|
|
||||||
_a: PhantomData
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ impl<T: ResponseError> From<T> for Error {
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
Error { cause: Box::new(err), backtrace: backtrace }
|
Error { cause: Box::new(err), backtrace }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,10 +566,10 @@ unsafe impl<T> Sync for InternalError<T> {}
|
|||||||
unsafe impl<T> Send for InternalError<T> {}
|
unsafe impl<T> Send for InternalError<T> {}
|
||||||
|
|
||||||
impl<T> InternalError<T> {
|
impl<T> InternalError<T> {
|
||||||
pub fn new(err: T, status: StatusCode) -> Self {
|
pub fn new(cause: T, status: StatusCode) -> Self {
|
||||||
InternalError {
|
InternalError {
|
||||||
cause: err,
|
cause,
|
||||||
status: status,
|
status,
|
||||||
backtrace: Backtrace::new(),
|
backtrace: Backtrace::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,10 +105,7 @@ pub struct Directory{
|
|||||||
|
|
||||||
impl Directory {
|
impl Directory {
|
||||||
pub fn new(base: PathBuf, path: PathBuf) -> Directory {
|
pub fn new(base: PathBuf, path: PathBuf) -> Directory {
|
||||||
Directory {
|
Directory { base, path }
|
||||||
base: base,
|
|
||||||
path: path
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn can_list(&self, entry: &io::Result<DirEntry>) -> bool {
|
fn can_list(&self, entry: &io::Result<DirEntry>) -> bool {
|
||||||
|
@ -215,7 +215,7 @@ impl<S, H, R> WrapHandler<S, H, R>
|
|||||||
S: 'static,
|
S: 'static,
|
||||||
{
|
{
|
||||||
pub fn new(h: H) -> Self {
|
pub fn new(h: H) -> Self {
|
||||||
WrapHandler{h: h, s: PhantomData}
|
WrapHandler{h, s: PhantomData}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ impl<S, H, R> RouteHandler<S> for WrapHandler<S, H, R>
|
|||||||
S: 'static,
|
S: 'static,
|
||||||
{
|
{
|
||||||
fn handle(&mut self, req: HttpRequest<S>) -> Reply {
|
fn handle(&mut self, req: HttpRequest<S>) -> Reply {
|
||||||
let req2 = req.clone_without_state();
|
let req2 = req.without_state();
|
||||||
match self.h.handle(req).respond_to(req2) {
|
match self.h.handle(req).respond_to(req2) {
|
||||||
Ok(reply) => reply.into(),
|
Ok(reply) => reply.into(),
|
||||||
Err(err) => Reply::response(err.into()),
|
Err(err) => Reply::response(err.into()),
|
||||||
@ -266,7 +266,7 @@ impl<S, H, F, R, E> RouteHandler<S> for AsyncHandler<S, H, F, R, E>
|
|||||||
S: 'static,
|
S: 'static,
|
||||||
{
|
{
|
||||||
fn handle(&mut self, req: HttpRequest<S>) -> Reply {
|
fn handle(&mut self, req: HttpRequest<S>) -> Reply {
|
||||||
let req2 = req.clone_without_state();
|
let req2 = req.without_state();
|
||||||
let fut = (self.h)(req)
|
let fut = (self.h)(req)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
.then(move |r| {
|
.then(move |r| {
|
||||||
@ -345,10 +345,10 @@ impl NormalizePath {
|
|||||||
/// Create new `NormalizePath` instance
|
/// Create new `NormalizePath` instance
|
||||||
pub fn new(append: bool, merge: bool, redirect: StatusCode) -> NormalizePath {
|
pub fn new(append: bool, merge: bool, redirect: StatusCode) -> NormalizePath {
|
||||||
NormalizePath {
|
NormalizePath {
|
||||||
append: append,
|
append,
|
||||||
merge: merge,
|
merge,
|
||||||
|
redirect,
|
||||||
re_merge: Regex::new("//+").unwrap(),
|
re_merge: Regex::new("//+").unwrap(),
|
||||||
redirect: redirect,
|
|
||||||
not_found: StatusCode::NOT_FOUND,
|
not_found: StatusCode::NOT_FOUND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,16 +106,16 @@ impl HttpRequest<()> {
|
|||||||
{
|
{
|
||||||
HttpRequest(
|
HttpRequest(
|
||||||
SharedHttpMessage::from_message(HttpMessage {
|
SharedHttpMessage::from_message(HttpMessage {
|
||||||
method: method,
|
method,
|
||||||
uri: uri,
|
uri,
|
||||||
version: version,
|
version,
|
||||||
headers: headers,
|
headers,
|
||||||
|
payload,
|
||||||
params: Params::new(),
|
params: Params::new(),
|
||||||
query: Params::new(),
|
query: Params::new(),
|
||||||
query_loaded: false,
|
query_loaded: false,
|
||||||
cookies: None,
|
cookies: None,
|
||||||
addr: None,
|
addr: None,
|
||||||
payload: payload,
|
|
||||||
extensions: Extensions::new(),
|
extensions: Extensions::new(),
|
||||||
info: None,
|
info: None,
|
||||||
}),
|
}),
|
||||||
@ -153,7 +153,7 @@ impl<S> HttpRequest<S> {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
/// Construct new http request without state.
|
/// Construct new http request without state.
|
||||||
pub(crate) fn clone_without_state(&self) -> HttpRequest {
|
pub(crate) fn without_state(&self) -> HttpRequest {
|
||||||
HttpRequest(self.0.clone(), None, None)
|
HttpRequest(self.0.clone(), None, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ impl<S> HttpRequest<S> {
|
|||||||
/// # fn main() {}
|
/// # fn main() {}
|
||||||
/// ```
|
/// ```
|
||||||
pub fn body(self) -> RequestBody {
|
pub fn body(self) -> RequestBody {
|
||||||
RequestBody::from(self)
|
RequestBody::new(self.without_state())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return stream to http payload processes as multipart.
|
/// Return stream to http payload processes as multipart.
|
||||||
@ -553,7 +553,7 @@ impl<S> HttpRequest<S> {
|
|||||||
/// # fn main() {}
|
/// # fn main() {}
|
||||||
/// ```
|
/// ```
|
||||||
pub fn urlencoded(self) -> UrlEncoded {
|
pub fn urlencoded(self) -> UrlEncoded {
|
||||||
UrlEncoded::from(self)
|
UrlEncoded::new(self.without_state())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse `application/json` encoded body.
|
/// Parse `application/json` encoded body.
|
||||||
@ -677,9 +677,9 @@ pub struct UrlEncoded {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UrlEncoded {
|
impl UrlEncoded {
|
||||||
pub fn from<S>(req: HttpRequest<S>) -> UrlEncoded {
|
pub fn new(req: HttpRequest) -> UrlEncoded {
|
||||||
UrlEncoded {
|
UrlEncoded {
|
||||||
req: Some(req.clone_without_state()),
|
req: Some(req),
|
||||||
limit: 262_144,
|
limit: 262_144,
|
||||||
fut: None,
|
fut: None,
|
||||||
}
|
}
|
||||||
@ -762,10 +762,10 @@ pub struct RequestBody {
|
|||||||
impl RequestBody {
|
impl RequestBody {
|
||||||
|
|
||||||
/// Create `RequestBody` for request.
|
/// Create `RequestBody` for request.
|
||||||
pub fn from<S>(req: HttpRequest<S>) -> RequestBody {
|
pub fn new(req: HttpRequest) -> RequestBody {
|
||||||
RequestBody {
|
RequestBody {
|
||||||
limit: 262_144,
|
limit: 262_144,
|
||||||
req: Some(req.clone_without_state()),
|
req: Some(req),
|
||||||
fut: None,
|
fut: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,11 +659,11 @@ impl InnerHttpResponse {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn new(status: StatusCode, body: Body) -> InnerHttpResponse {
|
fn new(status: StatusCode, body: Body) -> InnerHttpResponse {
|
||||||
InnerHttpResponse {
|
InnerHttpResponse {
|
||||||
|
status,
|
||||||
|
body,
|
||||||
version: None,
|
version: None,
|
||||||
headers: HeaderMap::with_capacity(16),
|
headers: HeaderMap::with_capacity(16),
|
||||||
status: status,
|
|
||||||
reason: None,
|
reason: None,
|
||||||
body: body,
|
|
||||||
chunked: None,
|
chunked: None,
|
||||||
encoding: None,
|
encoding: None,
|
||||||
connection_type: None,
|
connection_type: None,
|
||||||
|
@ -110,8 +110,8 @@ impl<'a> ConnectionInfo<'a> {
|
|||||||
ConnectionInfo {
|
ConnectionInfo {
|
||||||
scheme: scheme.unwrap_or("http"),
|
scheme: scheme.unwrap_or("http"),
|
||||||
host: host.unwrap_or("localhost"),
|
host: host.unwrap_or("localhost"),
|
||||||
remote: remote,
|
remote,
|
||||||
peer: peer,
|
peer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
//! * Supported *HTTP/1.x* and *HTTP/2.0* protocols
|
//! * Supported *HTTP/1.x* and *HTTP/2.0* protocols
|
||||||
//! * Streaming and pipelining
|
//! * Streaming and pipelining
|
||||||
//! * Keep-alive and slow requests handling
|
//! * Keep-alive and slow requests handling
|
||||||
//! * *WebSockets* server/client
|
//! * `WebSockets` server/client
|
||||||
//! * Transparent content compression/decompression (br, gzip, deflate)
|
//! * Transparent content compression/decompression (br, gzip, deflate)
|
||||||
//! * Configurable request routing
|
//! * Configurable request routing
|
||||||
//! * Multipart streams
|
//! * Multipart streams
|
||||||
|
@ -95,7 +95,7 @@ impl DefaultHeadersBuilder {
|
|||||||
/// Finishes building and returns the built `DefaultHeaders` middleware.
|
/// Finishes building and returns the built `DefaultHeaders` middleware.
|
||||||
pub fn finish(&mut self) -> DefaultHeaders {
|
pub fn finish(&mut self) -> DefaultHeaders {
|
||||||
let headers = self.headers.take().expect("cannot reuse middleware builder");
|
let headers = self.headers.take().expect("cannot reuse middleware builder");
|
||||||
DefaultHeaders{ ct: self.ct, headers: headers }
|
DefaultHeaders{ ct: self.ct, headers }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,8 +377,8 @@ impl<S> SessionBackend<S> for CookieSessionBackend {
|
|||||||
FutOk(
|
FutOk(
|
||||||
CookieSession {
|
CookieSession {
|
||||||
changed: false,
|
changed: false,
|
||||||
state: state,
|
|
||||||
inner: Rc::clone(&self.0),
|
inner: Rc::clone(&self.0),
|
||||||
|
state,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ impl<S> Multipart<S> where S: Stream<Item=Bytes, Error=PayloadError> {
|
|||||||
safety: Safety::new(),
|
safety: Safety::new(),
|
||||||
inner: Some(Rc::new(RefCell::new(
|
inner: Some(Rc::new(RefCell::new(
|
||||||
InnerMultipart {
|
InnerMultipart {
|
||||||
|
boundary,
|
||||||
payload: PayloadRef::new(PayloadHelper::new(stream)),
|
payload: PayloadRef::new(PayloadHelper::new(stream)),
|
||||||
boundary: boundary,
|
|
||||||
state: InnerState::FirstBoundary,
|
state: InnerState::FirstBoundary,
|
||||||
item: InnerMultipartItem::None,
|
item: InnerMultipartItem::None,
|
||||||
})))
|
})))
|
||||||
@ -369,12 +369,7 @@ impl<S> Field<S> where S: Stream<Item=Bytes, Error=PayloadError> {
|
|||||||
|
|
||||||
fn new(safety: Safety, headers: HeaderMap,
|
fn new(safety: Safety, headers: HeaderMap,
|
||||||
ct: mime::Mime, inner: Rc<RefCell<InnerField<S>>>) -> Self {
|
ct: mime::Mime, inner: Rc<RefCell<InnerField<S>>>) -> Self {
|
||||||
Field {
|
Field {ct, headers, inner, safety}
|
||||||
ct: ct,
|
|
||||||
headers: headers,
|
|
||||||
inner: inner,
|
|
||||||
safety: safety,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn headers(&self) -> &HeaderMap {
|
pub fn headers(&self) -> &HeaderMap {
|
||||||
@ -443,8 +438,8 @@ impl<S> InnerField<S> where S: Stream<Item=Bytes, Error=PayloadError> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ok(InnerField {
|
Ok(InnerField {
|
||||||
|
boundary,
|
||||||
payload: Some(payload),
|
payload: Some(payload),
|
||||||
boundary: boundary,
|
|
||||||
eof: false,
|
eof: false,
|
||||||
length: len })
|
length: len })
|
||||||
}
|
}
|
||||||
@ -596,7 +591,7 @@ impl Safety {
|
|||||||
Safety {
|
Safety {
|
||||||
task: None,
|
task: None,
|
||||||
level: Rc::strong_count(&payload),
|
level: Rc::strong_count(&payload),
|
||||||
payload: payload,
|
payload,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,7 +607,7 @@ impl Clone for Safety {
|
|||||||
Safety {
|
Safety {
|
||||||
task: Some(current_task()),
|
task: Some(current_task()),
|
||||||
level: Rc::strong_count(&payload),
|
level: Rc::strong_count(&payload),
|
||||||
payload: payload,
|
payload,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,8 +232,8 @@ impl Inner {
|
|||||||
|
|
||||||
fn new(eof: bool) -> Self {
|
fn new(eof: bool) -> Self {
|
||||||
Inner {
|
Inner {
|
||||||
|
eof,
|
||||||
len: 0,
|
len: 0,
|
||||||
eof: eof,
|
|
||||||
err: None,
|
err: None,
|
||||||
task: None,
|
task: None,
|
||||||
items: VecDeque::new(),
|
items: VecDeque::new(),
|
||||||
|
@ -72,7 +72,7 @@ struct PipelineInfo<S> {
|
|||||||
impl<S> PipelineInfo<S> {
|
impl<S> PipelineInfo<S> {
|
||||||
fn new(req: HttpRequest<S>) -> PipelineInfo<S> {
|
fn new(req: HttpRequest<S>) -> PipelineInfo<S> {
|
||||||
PipelineInfo {
|
PipelineInfo {
|
||||||
req: req,
|
req,
|
||||||
count: 0,
|
count: 0,
|
||||||
mws: Rc::new(Vec::new()),
|
mws: Rc::new(Vec::new()),
|
||||||
error: None,
|
error: None,
|
||||||
@ -108,9 +108,8 @@ impl<S: 'static, H: PipelineHandler<S>> Pipeline<S, H> {
|
|||||||
handler: Rc<RefCell<H>>) -> Pipeline<S, H>
|
handler: Rc<RefCell<H>>) -> Pipeline<S, H>
|
||||||
{
|
{
|
||||||
let mut info = PipelineInfo {
|
let mut info = PipelineInfo {
|
||||||
req: req,
|
req, mws,
|
||||||
count: 0,
|
count: 0,
|
||||||
mws: mws,
|
|
||||||
error: None,
|
error: None,
|
||||||
context: None,
|
context: None,
|
||||||
disconnected: None,
|
disconnected: None,
|
||||||
@ -307,7 +306,7 @@ impl<S: 'static, H> WaitingResponse<S, H> {
|
|||||||
RunMiddlewares::init(info, resp),
|
RunMiddlewares::init(info, resp),
|
||||||
ReplyItem::Future(fut) =>
|
ReplyItem::Future(fut) =>
|
||||||
PipelineState::Handler(
|
PipelineState::Handler(
|
||||||
WaitingResponse { fut: fut, _s: PhantomData, _h: PhantomData }),
|
WaitingResponse { fut, _s: PhantomData, _h: PhantomData }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +354,7 @@ impl<S: 'static, H> RunMiddlewares<S, H> {
|
|||||||
},
|
},
|
||||||
Ok(Response::Future(fut)) => {
|
Ok(Response::Future(fut)) => {
|
||||||
return PipelineState::RunMiddlewares(
|
return PipelineState::RunMiddlewares(
|
||||||
RunMiddlewares { curr: curr, fut: Some(fut),
|
RunMiddlewares { curr, fut: Some(fut),
|
||||||
_s: PhantomData, _h: PhantomData })
|
_s: PhantomData, _h: PhantomData })
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -444,7 +443,7 @@ impl<S: 'static, H> ProcessResponse<S, H> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn init(resp: HttpResponse) -> PipelineState<S, H> {
|
fn init(resp: HttpResponse) -> PipelineState<S, H> {
|
||||||
PipelineState::Response(
|
PipelineState::Response(
|
||||||
ProcessResponse{ resp: resp,
|
ProcessResponse{ resp,
|
||||||
iostate: IOState::Response,
|
iostate: IOState::Response,
|
||||||
running: RunningState::Running,
|
running: RunningState::Running,
|
||||||
drain: None, _s: PhantomData, _h: PhantomData})
|
drain: None, _s: PhantomData, _h: PhantomData})
|
||||||
@ -644,7 +643,7 @@ impl<S: 'static, H> FinishingMiddlewares<S, H> {
|
|||||||
if info.count == 0 {
|
if info.count == 0 {
|
||||||
Completed::init(info)
|
Completed::init(info)
|
||||||
} else {
|
} else {
|
||||||
let mut state = FinishingMiddlewares{resp: resp, fut: None,
|
let mut state = FinishingMiddlewares{resp, fut: None,
|
||||||
_s: PhantomData, _h: PhantomData};
|
_s: PhantomData, _h: PhantomData};
|
||||||
if let Some(st) = state.poll(info) {
|
if let Some(st) = state.poll(info) {
|
||||||
st
|
st
|
||||||
|
12
src/route.rs
12
src/route.rs
@ -179,14 +179,10 @@ impl<S: 'static> Compose<S> {
|
|||||||
mws: Rc<Vec<Box<Middleware<S>>>>,
|
mws: Rc<Vec<Box<Middleware<S>>>>,
|
||||||
handler: InnerHandler<S>) -> Self
|
handler: InnerHandler<S>) -> Self
|
||||||
{
|
{
|
||||||
let mut info = ComposeInfo {
|
let mut info = ComposeInfo { count: 0, req, mws, handler };
|
||||||
count: 0,
|
|
||||||
req: req,
|
|
||||||
mws: mws,
|
|
||||||
handler: handler };
|
|
||||||
let state = StartMiddlewares::init(&mut info);
|
let state = StartMiddlewares::init(&mut info);
|
||||||
|
|
||||||
Compose {state: state, info: info}
|
Compose {state, info}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +304,7 @@ impl<S: 'static> WaitingResponse<S> {
|
|||||||
RunMiddlewares::init(info, resp),
|
RunMiddlewares::init(info, resp),
|
||||||
ReplyItem::Future(fut) =>
|
ReplyItem::Future(fut) =>
|
||||||
ComposeState::Handler(
|
ComposeState::Handler(
|
||||||
WaitingResponse { fut: fut, _s: PhantomData }),
|
WaitingResponse { fut, _s: PhantomData }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +349,7 @@ impl<S: 'static> RunMiddlewares<S> {
|
|||||||
},
|
},
|
||||||
Ok(MiddlewareResponse::Future(fut)) => {
|
Ok(MiddlewareResponse::Future(fut)) => {
|
||||||
return ComposeState::RunMiddlewares(
|
return ComposeState::RunMiddlewares(
|
||||||
RunMiddlewares { curr: curr, fut: Some(fut), _s: PhantomData })
|
RunMiddlewares { curr, fut: Some(fut), _s: PhantomData })
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,9 @@ impl Router {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let len = prefix.len();
|
let prefix_len = prefix.len();
|
||||||
(Router(Rc::new(
|
(Router(Rc::new(
|
||||||
Inner{ prefix: prefix,
|
Inner{ prefix, prefix_len, named, patterns, srv: settings })), resources)
|
||||||
prefix_len: len,
|
|
||||||
named: named,
|
|
||||||
patterns: patterns,
|
|
||||||
srv: settings })), resources)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Router prefix
|
/// Router prefix
|
||||||
@ -168,10 +164,10 @@ impl Pattern {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Pattern {
|
Pattern {
|
||||||
tp: tp,
|
tp,
|
||||||
|
pattern,
|
||||||
|
elements,
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
pattern: pattern,
|
|
||||||
elements: elements,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ pub(crate) struct WrapperStream<T> where T: AsyncRead + AsyncWrite + 'static {
|
|||||||
|
|
||||||
impl<T> WrapperStream<T> where T: AsyncRead + AsyncWrite + 'static {
|
impl<T> WrapperStream<T> where T: AsyncRead + AsyncWrite + 'static {
|
||||||
pub fn new(io: T) -> Self {
|
pub fn new(io: T) -> Self {
|
||||||
WrapperStream{io: io}
|
WrapperStream{ io }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ pub(crate) struct EncodedPayload {
|
|||||||
|
|
||||||
impl EncodedPayload {
|
impl EncodedPayload {
|
||||||
pub fn new(inner: PayloadSender, enc: ContentEncoding) -> EncodedPayload {
|
pub fn new(inner: PayloadSender, enc: ContentEncoding) -> EncodedPayload {
|
||||||
EncodedPayload{ inner: inner, error: false, payload: PayloadStream::new(enc) }
|
EncodedPayload{ inner, error: false, payload: PayloadStream::new(enc) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,10 +821,7 @@ impl AcceptEncoding {
|
|||||||
Err(_) => 0.0,
|
Err(_) => 0.0,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some(AcceptEncoding {
|
Some(AcceptEncoding{ encoding, quality })
|
||||||
encoding: encoding,
|
|
||||||
quality: quality,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a raw Accept-Encoding header value into an ordered list.
|
/// Parse a raw Accept-Encoding header value into an ordered list.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
|
||||||
|
|
||||||
use std::{self, io};
|
use std::{self, io};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
@ -62,18 +64,20 @@ struct Entry {
|
|||||||
impl<T, H> Http1<T, H>
|
impl<T, H> Http1<T, H>
|
||||||
where T: IoStream, H: HttpHandler + 'static
|
where T: IoStream, H: HttpHandler + 'static
|
||||||
{
|
{
|
||||||
pub fn new(h: Rc<WorkerSettings<H>>, stream: T, addr: Option<SocketAddr>, buf: BytesMut)
|
pub fn new(settings: Rc<WorkerSettings<H>>,
|
||||||
-> Self
|
stream: T,
|
||||||
|
addr: Option<SocketAddr>, read_buf: BytesMut) -> Self
|
||||||
{
|
{
|
||||||
let bytes = h.get_shared_bytes();
|
let bytes = settings.get_shared_bytes();
|
||||||
Http1{ flags: Flags::KEEPALIVE,
|
Http1{ flags: Flags::KEEPALIVE,
|
||||||
settings: h,
|
|
||||||
addr: addr,
|
|
||||||
stream: H1Writer::new(stream, bytes),
|
stream: H1Writer::new(stream, bytes),
|
||||||
reader: Reader::new(),
|
reader: Reader::new(),
|
||||||
read_buf: buf,
|
|
||||||
tasks: VecDeque::new(),
|
tasks: VecDeque::new(),
|
||||||
keepalive_timer: None }
|
keepalive_timer: None,
|
||||||
|
addr,
|
||||||
|
read_buf,
|
||||||
|
settings,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn settings(&self) -> &WorkerSettings<H> {
|
pub fn settings(&self) -> &WorkerSettings<H> {
|
||||||
@ -540,7 +544,7 @@ impl Reader {
|
|||||||
let (psender, payload) = Payload::new(false);
|
let (psender, payload) = Payload::new(false);
|
||||||
let info = PayloadInfo {
|
let info = PayloadInfo {
|
||||||
tx: PayloadType::new(&msg.get_mut().headers, psender),
|
tx: PayloadType::new(&msg.get_mut().headers, psender),
|
||||||
decoder: decoder,
|
decoder,
|
||||||
};
|
};
|
||||||
msg.get_mut().payload = Some(payload);
|
msg.get_mut().payload = Some(payload);
|
||||||
Ok(Async::Ready((HttpRequest::from_message(msg), Some(info))))
|
Ok(Async::Ready((HttpRequest::from_message(msg), Some(info))))
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
|
||||||
|
|
||||||
use std::{io, mem};
|
use std::{io, mem};
|
||||||
use bytes::BufMut;
|
use bytes::BufMut;
|
||||||
use futures::{Async, Poll};
|
use futures::{Async, Poll};
|
||||||
@ -39,11 +41,11 @@ impl<T: AsyncWrite> H1Writer<T> {
|
|||||||
pub fn new(stream: T, buf: SharedBytes) -> H1Writer<T> {
|
pub fn new(stream: T, buf: SharedBytes) -> H1Writer<T> {
|
||||||
H1Writer {
|
H1Writer {
|
||||||
flags: Flags::empty(),
|
flags: Flags::empty(),
|
||||||
stream: stream,
|
|
||||||
encoder: ContentEncoder::empty(buf.clone()),
|
encoder: ContentEncoder::empty(buf.clone()),
|
||||||
written: 0,
|
written: 0,
|
||||||
headers_size: 0,
|
headers_size: 0,
|
||||||
buffer: buf,
|
buffer: buf,
|
||||||
|
stream,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
|
||||||
|
|
||||||
use std::{io, cmp, mem};
|
use std::{io, cmp, mem};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
@ -53,15 +55,17 @@ impl<T, H> Http2<T, H>
|
|||||||
where T: AsyncRead + AsyncWrite + 'static,
|
where T: AsyncRead + AsyncWrite + 'static,
|
||||||
H: HttpHandler + 'static
|
H: HttpHandler + 'static
|
||||||
{
|
{
|
||||||
pub fn new(h: Rc<WorkerSettings<H>>, io: T, addr: Option<SocketAddr>, buf: Bytes) -> Self
|
pub fn new(settings: Rc<WorkerSettings<H>>,
|
||||||
|
io: T,
|
||||||
|
addr: Option<SocketAddr>, buf: Bytes) -> Self
|
||||||
{
|
{
|
||||||
Http2{ flags: Flags::empty(),
|
Http2{ flags: Flags::empty(),
|
||||||
settings: h,
|
|
||||||
addr: addr,
|
|
||||||
tasks: VecDeque::new(),
|
tasks: VecDeque::new(),
|
||||||
state: State::Handshake(
|
state: State::Handshake(
|
||||||
server::handshake(IoWrapper{unread: Some(buf), inner: io})),
|
server::handshake(IoWrapper{unread: Some(buf), inner: io})),
|
||||||
keepalive_timer: None,
|
keepalive_timer: None,
|
||||||
|
addr,
|
||||||
|
settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,10 +290,10 @@ impl Entry {
|
|||||||
|
|
||||||
Entry {task: task.unwrap_or_else(|| Pipeline::error(HTTPNotFound)),
|
Entry {task: task.unwrap_or_else(|| Pipeline::error(HTTPNotFound)),
|
||||||
payload: psender,
|
payload: psender,
|
||||||
recv: recv,
|
|
||||||
stream: H2Writer::new(resp, settings.get_shared_bytes()),
|
stream: H2Writer::new(resp, settings.get_shared_bytes()),
|
||||||
flags: EntryFlags::empty(),
|
flags: EntryFlags::empty(),
|
||||||
capacity: 0,
|
capacity: 0,
|
||||||
|
recv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]
|
||||||
|
|
||||||
use std::{io, cmp};
|
use std::{io, cmp};
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use futures::{Async, Poll};
|
use futures::{Async, Poll};
|
||||||
@ -38,7 +40,7 @@ impl H2Writer {
|
|||||||
|
|
||||||
pub fn new(respond: SendResponse<Bytes>, buf: SharedBytes) -> H2Writer {
|
pub fn new(respond: SendResponse<Bytes>, buf: SharedBytes) -> H2Writer {
|
||||||
H2Writer {
|
H2Writer {
|
||||||
respond: respond,
|
respond,
|
||||||
stream: None,
|
stream: None,
|
||||||
encoder: ContentEncoder::empty(buf.clone()),
|
encoder: ContentEncoder::empty(buf.clone()),
|
||||||
flags: Flags::empty(),
|
flags: Flags::empty(),
|
||||||
|
@ -36,11 +36,7 @@ impl ServerSettings {
|
|||||||
} else {
|
} else {
|
||||||
"localhost".to_owned()
|
"localhost".to_owned()
|
||||||
};
|
};
|
||||||
ServerSettings {
|
ServerSettings { addr, secure, host }
|
||||||
addr: addr,
|
|
||||||
secure: secure,
|
|
||||||
host: host,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the socket address of the local half of this TCP connection
|
/// Returns the socket address of the local half of this TCP connection
|
||||||
|
@ -62,7 +62,7 @@ impl<H: HttpHandler + 'static> Worker<H> {
|
|||||||
Worker {
|
Worker {
|
||||||
settings: Rc::new(WorkerSettings::new(h, keep_alive)),
|
settings: Rc::new(WorkerSettings::new(h, keep_alive)),
|
||||||
hnd: Arbiter::handle().clone(),
|
hnd: Arbiter::handle().clone(),
|
||||||
handler: handler,
|
handler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/test.rs
18
src/test.rs
@ -94,12 +94,12 @@ impl TestServer {
|
|||||||
let _ = sys.run();
|
let _ = sys.run();
|
||||||
});
|
});
|
||||||
|
|
||||||
let (sys, addr) = rx.recv().unwrap();
|
let (server_sys, addr) = rx.recv().unwrap();
|
||||||
TestServer {
|
TestServer {
|
||||||
addr: addr,
|
addr,
|
||||||
thread: Some(join),
|
thread: Some(join),
|
||||||
system: System::new("actix-test"),
|
system: System::new("actix-test"),
|
||||||
server_sys: sys,
|
server_sys,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,12 +131,12 @@ impl TestServer {
|
|||||||
let _ = sys.run();
|
let _ = sys.run();
|
||||||
});
|
});
|
||||||
|
|
||||||
let (sys, addr) = rx.recv().unwrap();
|
let (server_sys, addr) = rx.recv().unwrap();
|
||||||
TestServer {
|
TestServer {
|
||||||
addr: addr,
|
addr,
|
||||||
|
server_sys,
|
||||||
thread: Some(join),
|
thread: Some(join),
|
||||||
system: System::new("actix-test"),
|
system: System::new("actix-test"),
|
||||||
server_sys: sys,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ impl<S> TestRequest<S> {
|
|||||||
/// Start HttpRequest build process with application state
|
/// Start HttpRequest build process with application state
|
||||||
pub fn with_state(state: S) -> TestRequest<S> {
|
pub fn with_state(state: S) -> TestRequest<S> {
|
||||||
TestRequest {
|
TestRequest {
|
||||||
state: state,
|
state,
|
||||||
method: Method::GET,
|
method: Method::GET,
|
||||||
uri: Uri::from_str("/").unwrap(),
|
uri: Uri::from_str("/").unwrap(),
|
||||||
version: Version::HTTP_11,
|
version: Version::HTTP_11,
|
||||||
@ -434,7 +434,7 @@ impl<S> TestRequest<S> {
|
|||||||
let req = self.finish();
|
let req = self.finish();
|
||||||
let resp = h.handle(req.clone());
|
let resp = h.handle(req.clone());
|
||||||
|
|
||||||
match resp.respond_to(req.clone_without_state()) {
|
match resp.respond_to(req.without_state()) {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
match resp.into().into() {
|
match resp.into().into() {
|
||||||
ReplyItem::Message(resp) => Ok(resp),
|
ReplyItem::Message(resp) => Ok(resp),
|
||||||
@ -461,7 +461,7 @@ impl<S> TestRequest<S> {
|
|||||||
let mut core = Core::new().unwrap();
|
let mut core = Core::new().unwrap();
|
||||||
match core.run(fut) {
|
match core.run(fut) {
|
||||||
Ok(r) => {
|
Ok(r) => {
|
||||||
match r.respond_to(req.clone_without_state()) {
|
match r.respond_to(req.without_state()) {
|
||||||
Ok(reply) => match reply.into().into() {
|
Ok(reply) => match reply.into().into() {
|
||||||
ReplyItem::Message(resp) => Ok(resp),
|
ReplyItem::Message(resp) => Ok(resp),
|
||||||
_ => panic!("Nested async replies are not supported"),
|
_ => panic!("Nested async replies are not supported"),
|
||||||
|
@ -130,7 +130,7 @@ impl WsClient {
|
|||||||
http_err: None,
|
http_err: None,
|
||||||
origin: None,
|
origin: None,
|
||||||
protocols: None,
|
protocols: None,
|
||||||
conn: conn,
|
conn,
|
||||||
};
|
};
|
||||||
cl.request.uri(uri.as_ref());
|
cl.request.uri(uri.as_ref());
|
||||||
cl
|
cl
|
||||||
@ -253,7 +253,7 @@ impl WsHandshake {
|
|||||||
io::ErrorKind::Other, "disconnected").into()))));
|
io::ErrorKind::Other, "disconnected").into()))));
|
||||||
|
|
||||||
WsHandshake {
|
WsHandshake {
|
||||||
key: key,
|
key,
|
||||||
inner: None,
|
inner: None,
|
||||||
request: Some(request.with_connector(conn.clone())),
|
request: Some(request.with_connector(conn.clone())),
|
||||||
tx: Some(tx),
|
tx: Some(tx),
|
||||||
@ -261,7 +261,7 @@ impl WsHandshake {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WsHandshake {
|
WsHandshake {
|
||||||
key: key,
|
key,
|
||||||
inner: None,
|
inner: None,
|
||||||
request: None,
|
request: None,
|
||||||
tx: None,
|
tx: None,
|
||||||
@ -340,7 +340,7 @@ impl Future for WsHandshake {
|
|||||||
|
|
||||||
let inner = Rc::new(UnsafeCell::new(inner));
|
let inner = Rc::new(UnsafeCell::new(inner));
|
||||||
Ok(Async::Ready(
|
Ok(Async::Ready(
|
||||||
(WsClientReader{inner: Rc::clone(&inner)}, WsClientWriter{inner: inner})))
|
(WsClientReader{inner: Rc::clone(&inner)}, WsClientWriter{inner})))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,13 +146,7 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(Async::Ready(Some(Frame {
|
Ok(Async::Ready(Some(Frame {
|
||||||
finished: finished,
|
finished, rsv1, rsv2, rsv3, opcode, payload: data.into() })))
|
||||||
rsv1: rsv1,
|
|
||||||
rsv2: rsv2,
|
|
||||||
rsv3: rsv3,
|
|
||||||
opcode: opcode,
|
|
||||||
payload: data.into(),
|
|
||||||
})))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generate binary representation
|
/// Generate binary representation
|
||||||
|
Loading…
Reference in New Issue
Block a user