From a22388bbd1377f75d3b873c59f6836cd12c2abe5 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 16 May 2023 17:00:59 -0600 Subject: fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154) Fixes for various `Attemped to access invalid request` bugs (#19058, #15427, #17213). We did not wait for both a drop event and a completion event before removing items from the slab table. This ensures that we do so. In addition, the slab methods are refactored out into `slab.rs` for maintainability. --- ext/http/00_serve.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ext/http/00_serve.js') diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js index 69ad88566..35af49b04 100644 --- a/ext/http/00_serve.js +++ b/ext/http/00_serve.js @@ -534,6 +534,8 @@ function mapToCallback(responseBodies, context, signal, callback, onError) { // Did everything shut down while we were waiting? if (context.closed) { + // We're shutting down, so this status shouldn't make it back to the client but "Service Unavailable" seems appropriate + op_http_set_promise_complete(req, 503); innerRequest?.close(); return; } -- cgit v1.2.3