mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-18 15:35:43 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e58b38fd13 | ||
|
b043c34632 | ||
|
b748bf3b0d | ||
|
be12d5e6fc | ||
|
7c4941f868 |
@@ -1,5 +1,10 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## 0.6.2 (2018-05-09)
|
||||||
|
|
||||||
|
* WsWriter trait is optional.
|
||||||
|
|
||||||
|
|
||||||
## 0.6.1 (2018-05-08)
|
## 0.6.1 (2018-05-08)
|
||||||
|
|
||||||
* Fix http/2 payload streaming #215
|
* Fix http/2 payload streaming #215
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
## Migration from 0.5 to 0.6
|
## Migration from 0.5 to 0.6
|
||||||
|
|
||||||
|
* `Path<T>` extractor return `ErrorNotFound` on failure instead of `ErrorBadRequest`
|
||||||
|
|
||||||
* `ws::Message::Close` now includes optional close reason.
|
* `ws::Message::Close` now includes optional close reason.
|
||||||
`ws::CloseCode::Status` and `ws::CloseCode::Empty` have been removed.
|
`ws::CloseCode::Status` and `ws::CloseCode::Empty` have been removed.
|
||||||
|
|
||||||
|
@@ -175,6 +175,9 @@ pub use httprequest::HttpRequest;
|
|||||||
pub use httpresponse::HttpResponse;
|
pub use httpresponse::HttpResponse;
|
||||||
pub use json::Json;
|
pub use json::Json;
|
||||||
pub use scope::Scope;
|
pub use scope::Scope;
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[deprecated(since = "0.6.2", note = "please use `use actix_web::ws::WsWriter`")]
|
||||||
pub use ws::WsWriter;
|
pub use ws::WsWriter;
|
||||||
|
|
||||||
#[cfg(feature = "openssl")]
|
#[cfg(feature = "openssl")]
|
||||||
|
@@ -518,24 +518,22 @@ impl ClientWriter {
|
|||||||
fn as_mut(&mut self) -> &mut Inner {
|
fn as_mut(&mut self) -> &mut Inner {
|
||||||
unsafe { &mut *self.inner.get() }
|
unsafe { &mut *self.inner.get() }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl WsWriter for ClientWriter {
|
|
||||||
/// Send text frame
|
/// Send text frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn text<T: Into<Binary>>(&mut self, text: T) {
|
pub fn text<T: Into<Binary>>(&mut self, text: T) {
|
||||||
self.write(Frame::message(text.into(), OpCode::Text, true, true));
|
self.write(Frame::message(text.into(), OpCode::Text, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send binary frame
|
/// Send binary frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn binary<B: Into<Binary>>(&mut self, data: B) {
|
pub fn binary<B: Into<Binary>>(&mut self, data: B) {
|
||||||
self.write(Frame::message(data, OpCode::Binary, true, true));
|
self.write(Frame::message(data, OpCode::Binary, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send ping frame
|
/// Send ping frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ping(&mut self, message: &str) {
|
pub fn ping(&mut self, message: &str) {
|
||||||
self.write(Frame::message(
|
self.write(Frame::message(
|
||||||
Vec::from(message),
|
Vec::from(message),
|
||||||
OpCode::Ping,
|
OpCode::Ping,
|
||||||
@@ -546,7 +544,7 @@ impl WsWriter for ClientWriter {
|
|||||||
|
|
||||||
/// Send pong frame
|
/// Send pong frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn pong(&mut self, message: &str) {
|
pub fn pong(&mut self, message: &str) {
|
||||||
self.write(Frame::message(
|
self.write(Frame::message(
|
||||||
Vec::from(message),
|
Vec::from(message),
|
||||||
OpCode::Pong,
|
OpCode::Pong,
|
||||||
@@ -557,7 +555,39 @@ impl WsWriter for ClientWriter {
|
|||||||
|
|
||||||
/// Send close frame
|
/// Send close frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn close(&mut self, reason: Option<CloseReason>) {
|
pub fn close(&mut self, reason: Option<CloseReason>) {
|
||||||
self.write(Frame::close(reason, true));
|
self.write(Frame::close(reason, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WsWriter for ClientWriter {
|
||||||
|
/// Send text frame
|
||||||
|
#[inline]
|
||||||
|
fn send_text<T: Into<Binary>>(&mut self, text: T) {
|
||||||
|
self.text(text)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send binary frame
|
||||||
|
#[inline]
|
||||||
|
fn send_binary<B: Into<Binary>>(&mut self, data: B) {
|
||||||
|
self.binary(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send ping frame
|
||||||
|
#[inline]
|
||||||
|
fn send_ping(&mut self, message: &str) {
|
||||||
|
self.ping(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send pong frame
|
||||||
|
#[inline]
|
||||||
|
fn send_pong(&mut self, message: &str) {
|
||||||
|
self.pong(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send close frame
|
||||||
|
#[inline]
|
||||||
|
fn send_close(&mut self, reason: Option<CloseReason>) {
|
||||||
|
self.close(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -149,6 +149,46 @@ where
|
|||||||
Drain::new(rx)
|
Drain::new(rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send text frame
|
||||||
|
#[inline]
|
||||||
|
pub fn text<T: Into<Binary>>(&mut self, text: T) {
|
||||||
|
self.write(Frame::message(text.into(), OpCode::Text, true, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send binary frame
|
||||||
|
#[inline]
|
||||||
|
pub fn binary<B: Into<Binary>>(&mut self, data: B) {
|
||||||
|
self.write(Frame::message(data, OpCode::Binary, true, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send ping frame
|
||||||
|
#[inline]
|
||||||
|
pub fn ping(&mut self, message: &str) {
|
||||||
|
self.write(Frame::message(
|
||||||
|
Vec::from(message),
|
||||||
|
OpCode::Ping,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send pong frame
|
||||||
|
#[inline]
|
||||||
|
pub fn pong(&mut self, message: &str) {
|
||||||
|
self.write(Frame::message(
|
||||||
|
Vec::from(message),
|
||||||
|
OpCode::Pong,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Send close frame
|
||||||
|
#[inline]
|
||||||
|
pub fn close(&mut self, reason: Option<CloseReason>) {
|
||||||
|
self.write(Frame::close(reason, false));
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if connection still open
|
/// Check if connection still open
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn connected(&self) -> bool {
|
pub fn connected(&self) -> bool {
|
||||||
@@ -181,42 +221,32 @@ where
|
|||||||
{
|
{
|
||||||
/// Send text frame
|
/// Send text frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn text<T: Into<Binary>>(&mut self, text: T) {
|
fn send_text<T: Into<Binary>>(&mut self, text: T) {
|
||||||
self.write(Frame::message(text.into(), OpCode::Text, true, false));
|
self.text(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send binary frame
|
/// Send binary frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn binary<B: Into<Binary>>(&mut self, data: B) {
|
fn send_binary<B: Into<Binary>>(&mut self, data: B) {
|
||||||
self.write(Frame::message(data, OpCode::Binary, true, false));
|
self.binary(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send ping frame
|
/// Send ping frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ping(&mut self, message: &str) {
|
fn send_ping(&mut self, message: &str) {
|
||||||
self.write(Frame::message(
|
self.ping(message)
|
||||||
Vec::from(message),
|
|
||||||
OpCode::Ping,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send pong frame
|
/// Send pong frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn pong(&mut self, message: &str) {
|
fn send_pong(&mut self, message: &str) {
|
||||||
self.write(Frame::message(
|
self.pong(message)
|
||||||
Vec::from(message),
|
|
||||||
OpCode::Pong,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send close frame
|
/// Send close frame
|
||||||
#[inline]
|
#[inline]
|
||||||
fn close(&mut self, reason: Option<CloseReason>) {
|
fn send_close(&mut self, reason: Option<CloseReason>) {
|
||||||
self.write(Frame::close(reason, false));
|
self.close(reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -343,15 +343,15 @@ where
|
|||||||
/// Common writing methods for a websocket.
|
/// Common writing methods for a websocket.
|
||||||
pub trait WsWriter {
|
pub trait WsWriter {
|
||||||
/// Send a text
|
/// Send a text
|
||||||
fn text<T: Into<Binary>>(&mut self, text: T);
|
fn send_text<T: Into<Binary>>(&mut self, text: T);
|
||||||
/// Send a binary
|
/// Send a binary
|
||||||
fn binary<B: Into<Binary>>(&mut self, data: B);
|
fn send_binary<B: Into<Binary>>(&mut self, data: B);
|
||||||
/// Send a ping message
|
/// Send a ping message
|
||||||
fn ping(&mut self, message: &str);
|
fn send_ping(&mut self, message: &str);
|
||||||
/// Send a pong message
|
/// Send a pong message
|
||||||
fn pong(&mut self, message: &str);
|
fn send_pong(&mut self, message: &str);
|
||||||
/// Close the connection
|
/// Close the connection
|
||||||
fn close(&mut self, reason: Option<CloseReason>);
|
fn send_close(&mut self, reason: Option<CloseReason>);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Reference in New Issue
Block a user