summaryrefslogtreecommitdiff
path: root/ext/http/http_next.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-07-25 18:12:19 -0400
committerGitHub <noreply@github.com>2023-07-25 18:12:19 -0400
commit7616ffe16724e39f7b4a710b208852bedb3cdced (patch)
tree49fbd205dde1729ad5b281e23eb514f0dbd90210 /ext/http/http_next.rs
parent06209f824cf398bcd3332dc37f2d22cbdd840647 (diff)
fix(ext/http): Quietly ignore invalid status codes (#19936)
Diffstat (limited to 'ext/http/http_next.rs')
-rw-r--r--ext/http/http_next.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs
index 5635fbd4b..cd63bc899 100644
--- a/ext/http/http_next.rs
+++ b/ext/http/http_next.rs
@@ -214,8 +214,11 @@ pub async fn op_http_upgrade_websocket_next(
#[op2(fast)]
pub fn op_http_set_promise_complete(#[smi] slab_id: SlabId, status: u16) {
let mut http = slab_get(slab_id);
- // The Javascript code will never provide a status that is invalid here (see 23_response.js)
- *http.response().status_mut() = StatusCode::from_u16(status).unwrap();
+ // The Javascript code should never provide a status that is invalid here (see 23_response.js), so we
+ // will quitely ignore invalid values.
+ if let Ok(code) = StatusCode::from_u16(status) {
+ *http.response().status_mut() = code;
+ }
http.complete();
}