summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
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/node/polyfills
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/node/polyfills')
-rw-r--r--ext/node/polyfills/http.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts
index 6b862ce83..ec3fe6e0b 100644
--- a/ext/node/polyfills/http.ts
+++ b/ext/node/polyfills/http.ts
@@ -671,6 +671,9 @@ class ClientRequest extends OutgoingMessage {
(async () => {
try {
const res = await op_fetch_send(this._req.requestRid);
+ if (this._req.cancelHandleRid !== null) {
+ core.tryClose(this._req.cancelHandleRid);
+ }
try {
cb?.();
} catch (_) {
@@ -709,10 +712,6 @@ class ClientRequest extends OutgoingMessage {
Object.entries(res.headers).flat().length,
);
- if (this._req.cancelHandleRid !== null) {
- core.tryClose(this._req.cancelHandleRid);
- }
-
if (incoming.upgrade) {
if (this.listenerCount("upgrade") === 0) {
// No listeners, so we got nothing to do