1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-18 13:51:50 +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, dst,
&mut msg, &mut msg,
false, false,
false,
inner.version, inner.version,
length, length,
inner.ctype, inner.ctype,

View File

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

View File

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

View File

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