From 679b7bb8fafc1464d5eb1c48989d477157be2330 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sat, 18 Nov 2023 13:16:53 -0700 Subject: fix(ext/http): fix crash in dropped Deno.serve requests (#21252) Fixes #21250 We were attempting to recycle dropped resource responses too early. --- ext/http/http_next.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/http') diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs index 98fbd1f8b..9504a6fa4 100644 --- a/ext/http/http_next.rs +++ b/ext/http/http_next.rs @@ -716,6 +716,8 @@ pub async fn op_http_set_response_body_resource( } }; + *http.needs_close_after_finish() = true; + set_response( http.clone(), resource.size_hint().1.map(|s| s as usize), @@ -726,7 +728,6 @@ pub async fn op_http_set_response_body_resource( }, ); - *http.needs_close_after_finish() = true; http.response_body_finished().await; Ok(()) } -- cgit v1.2.3