mirror of https://github.com/fafhrd91/actix-web
fix broken compression when feeding data larger than 64 KiB
This commit is contained in:
parent
e1440079e7
commit
b6893b13cd
|
@ -1320,6 +1320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
|
"libz-sys",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1922,6 +1923,18 @@ dependencies = [
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libz-sys"
|
||||||
|
version = "1.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
"vcpkg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.6"
|
version = "0.5.6"
|
||||||
|
|
|
@ -530,8 +530,8 @@ impl DeflateCompressionContext {
|
||||||
let mut buf = [0u8; BUF_SIZE];
|
let mut buf = [0u8; BUF_SIZE];
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let total_in = self.compress.total_in() - self.total_bytes_read;
|
let bytes_in = self.compress.total_in() - self.total_bytes_read;
|
||||||
let res = if total_in >= payload.len() as u64 {
|
let res = if bytes_in >= payload.len() as u64 {
|
||||||
self.compress
|
self.compress
|
||||||
.compress(&[], &mut buf, flate2::FlushCompress::Sync)
|
.compress(&[], &mut buf, flate2::FlushCompress::Sync)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
|
@ -540,7 +540,11 @@ impl DeflateCompressionContext {
|
||||||
})?
|
})?
|
||||||
} else {
|
} else {
|
||||||
self.compress
|
self.compress
|
||||||
.compress(&payload, &mut buf, flate2::FlushCompress::None)
|
.compress(
|
||||||
|
&payload[bytes_in as usize..],
|
||||||
|
&mut buf,
|
||||||
|
flate2::FlushCompress::None,
|
||||||
|
)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
self.reset();
|
self.reset();
|
||||||
ProtocolError::Io(err.into())
|
ProtocolError::Io(err.into())
|
||||||
|
|
Loading…
Reference in New Issue