summaryrefslogtreecommitdiff
path: root/ext/http/00_serve.js
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-05-16 17:00:59 -0600
committerGitHub <noreply@github.com>2023-05-16 17:00:59 -0600
commita22388bbd1377f75d3b873c59f6836cd12c2abe5 (patch)
tree04b9879ab7172884b3417fdf1a3d170564c54726 /ext/http/00_serve.js
parent9ba2c4c42fcbadea1f19c67c88b5cbc4c97804f3 (diff)
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.
Diffstat (limited to 'ext/http/00_serve.js')
-rw-r--r--ext/http/00_serve.js2
1 files changed, 2 insertions, 0 deletions
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;
}