summaryrefslogtreecommitdiff
path: root/ext/http/http_next.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-11-07 17:12:13 +0530
committerGitHub <noreply@github.com>2024-11-07 17:12:13 +0530
commitb9262130fec34137e38c922015c6b671c0fa9396 (patch)
treef8095a4939560aadbf9bd11d2dcc55f75d4e38a4 /ext/http/http_next.rs
parent742744d4985548a948bc90e78673c0c22d607d8a (diff)
feat(ext/http): abort signal when request is cancelled (#26761)
Closes https://github.com/denoland/deno/issues/21653
Diffstat (limited to 'ext/http/http_next.rs')
-rw-r--r--ext/http/http_next.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs
index 56c46de92..326478fe7 100644
--- a/ext/http/http_next.rs
+++ b/ext/http/http_next.rs
@@ -700,6 +700,14 @@ fn set_response(
http.complete();
}
+#[op2(fast)]
+pub fn op_http_get_request_cancelled(external: *const c_void) -> bool {
+ let http =
+ // SAFETY: op is called with external.
+ unsafe { clone_external!(external, "op_http_get_request_cancelled") };
+ http.cancelled()
+}
+
/// Returned promise resolves when body streaming finishes.
/// Call [`op_http_close_after_finish`] when done with the external.
#[op2(async)]