summaryrefslogtreecommitdiff
path: root/ext/http
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-05-28 21:46:04 +0100
committerGitHub <noreply@github.com>2024-05-28 22:46:04 +0200
commit7d8a8a04614cd3a9ef57569505ae6eb728869ecd (patch)
treef5349b834879684d9cb54459018dd93dac9a602d /ext/http
parent69da5d8290fda4797af5e3b3e5e7bf3c0141f203 (diff)
fix(ext/http): flush gzip streaming response (#23991)
This commit changes `gzip` compression in `Deno.serve` API to flush data after each write. There's a slight performance regression, but provided test shows a scenario that was not possible before. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'ext/http')
-rw-r--r--ext/http/response_body.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/http/response_body.rs b/ext/http/response_body.rs
index fd1203f53..3c25265d7 100644
--- a/ext/http/response_body.rs
+++ b/ext/http/response_body.rs
@@ -394,7 +394,7 @@ impl PollFrame for GZipResponseStream {
stm.compress(&[], &mut buf, flate2::FlushCompress::Finish)
}
ResponseStreamResult::NonEmptyBuf(mut input) => {
- let res = stm.compress(&input, &mut buf, flate2::FlushCompress::None);
+ let res = stm.compress(&input, &mut buf, flate2::FlushCompress::Sync);
let len_in = (stm.total_in() - start_in) as usize;
debug_assert!(len_in <= input.len());
this.crc.update(&input[..len_in]);