Skip to content

Commit b485bad

Browse files
committed
fix(ws): commit ws request headers before upgrading
1 parent b9b1452 commit b485bad

File tree

5 files changed

+284
-85
lines changed

5 files changed

+284
-85
lines changed

runtime/fastly/builtins/fastly.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ bool Fastly::createWebsocketHandoff(JSContext *cx, unsigned argc, JS::Value *vp)
309309
}
310310
auto websocket_upgrade_request = &request_value.toObject();
311311

312+
RootedObject request(cx, websocket_upgrade_request);
313+
if (!RequestOrResponse::commit_headers(cx, request)) {
314+
return false;
315+
}
316+
312317
auto response_handle = host_api::HttpResp::make();
313318
if (auto *err = response_handle.to_err()) {
314319
HANDLE_ERROR(cx, *err);

runtime/fastly/builtins/fetch/request-response.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,9 +2962,11 @@ std::optional<host_api::HttpReq> Response::websocket_upgrade_request(JSObject *o
29622962
MOZ_ASSERT(is_instance(obj));
29632963
auto websocket_upgrade_request =
29642964
JS::GetReservedSlot(obj, static_cast<uint32_t>(Slots::WebsocketUpgradeRequest));
2965+
29652966
if (websocket_upgrade_request.isUndefined()) {
29662967
return std::nullopt;
29672968
}
2969+
29682970
return host_api::HttpReq(websocket_upgrade_request.toInt32());
29692971
}
29702972

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
warning: only one of `license` or `license-file` is necessary
2+
`license` should be used if the package license can be expressed with a standard SPDX expression.
3+
`license-file` should be used if the package uses a non-standard license.
4+
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields for more information.
5+
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s

0 commit comments

Comments
 (0)