deno
0287945c - fix(ext/http): don't consume the http record when socket reclaim can't succeed

Commit
9 days ago
fix(ext/http): don't consume the http record when socket reclaim can't succeed op_http_reclaim_socket freed the external and took the connection BEFORE attempting the fd conversion, which was hardwired to fail on Windows (and fails for TLS/tunnel streams everywhere). JS only nulls its external refs on success, so on Windows a demoted response (test-http-response-cork) kept driving response ops on the freed record and panicked with 'Detected an invalid v8::External (expected http record)'. - Decide reclaimability from the stream type via a borrow before consuming anything; unsupported streams report -1 with the external and connection intact. - Implement the Windows conversion (into_raw_socket; kernel handles fit in 32 bits and tcp_wrap's open op already adopts an i32 SOCKET via uv_tcp_open), so the cork demotion path works instead of panicking. - The residual consumed-but-failed case (into_std erroring) now reports -2 and JS drops its external references instead of using the freed record.
Author
Committer
Parents
Loading