1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

do not chunk websocket stream

This commit is contained in:
Nikolay Kim 2019-03-17 21:57:53 -07:00
parent 85c2887b30
commit f26d4b6a23
4 changed files with 9 additions and 6 deletions

View File

@ -211,6 +211,7 @@ impl Encoder for ClientCodec {
dst,
&mut msg,
false,
false,
inner.version,
length,
inner.ctype,

View File

@ -170,6 +170,7 @@ impl Encoder for Codec {
dst,
&mut res,
self.flags.contains(Flags::HEAD),
self.flags.contains(Flags::STREAM),
self.version,
length,
self.ctype,

View File

@ -323,17 +323,17 @@ where
match msg {
Message::Item(mut req) => {
match self.framed.get_codec().message_type() {
MessageType::Payload => {
MessageType::Payload | MessageType::Stream => {
let (ps, pl) = Payload::create(false);
let (req1, _) =
req.replace_payload(crate::Payload::H1(pl));
req = req1;
self.payload = Some(ps);
}
MessageType::Stream => {
self.unhandled = Some(req);
return Ok(updated);
}
//MessageType::Stream => {
// self.unhandled = Some(req);
// return Ok(updated);
//}
_ => (),
}

View File

@ -241,6 +241,7 @@ impl<T: MessageType> MessageEncoder<T> {
dst: &mut BytesMut,
message: &mut T,
head: bool,
stream: bool,
version: Version,
length: BodyLength,
ctype: ConnectionType,
@ -253,7 +254,7 @@ impl<T: MessageType> MessageEncoder<T> {
BodyLength::Sized(len) => TransferEncoding::length(len as u64),
BodyLength::Sized64(len) => TransferEncoding::length(len),
BodyLength::Stream => {
if message.chunked() {
if message.chunked() && !stream {
TransferEncoding::chunked()
} else {
TransferEncoding::eof()