mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
### What does this PR do? This does two things: 1. Fix an ASAN use-after-poison on macOS involving `ws` module when running websocket.test.js. This was caused by the `open` callback firing before the `.upgrade` function call returns. We need to update the `socket` value on the ServerWebSocket to ensure the `NodeHTTPResponse` object is kept alive for as long as it should be, but the `us_socket_t` address can, in theory, change due to `realloc` being used when adopting the socket. 2. Fixes an "undefined is not a function" error when the websocket upgrade fails. This occurred because the `_httpMessage` property is not set when a socket is upgraded ### How did you verify your code works? There is a test and the asan error no longer triggers --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>