deno
528ed976 - fix(ext/node): http client compat improvements (#33337)

Commit
226 days ago
fix(ext/node): http client compat improvements (#33337) ## Summary Several fixes to `node:http` client and server compatibility: - **Fix response abort/error not emitting on `req.abort()`** - removed overly broad `req.destroyed` guard in `socketCloseListener` that prevented cleanup of the response stream - **Fix keep-alive socket pooling with server-initiated close** - use `socket.destroyed` for early exit in agent's `'free'` handler, but still check `!socket.writable` before assigning to queued requests (prevents handing half-closed sockets to new requests) - **Make `http.globalAgent` assignable** - `globalAgent` was a static import binding; now uses getter/setter so `http.globalAgent = newAgent` takes effect on subsequent requests - **Spread URL object in `urlToHttpOptions`** - match Node's `...url` spread so user-added properties (like `headers`) on URL objects are preserved - **Detach socket on HTTP CONNECT/upgrade** - remove all server-added listeners from the socket before emitting the `'connect'`/`'upgrade'` event, matching Node's behavior - **Implement `ERR_HTTP_CONTENT_LENGTH_MISMATCH`** - add strict content-length validation in `write_()` and `end()` when `strictContentLength` is enabled --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading