diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-10-16 20:56:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-17 03:56:57 +0000 |
commit | a61ba3c6995bef58f508a34e537932284692c294 (patch) | |
tree | 75e3e3dbba7b648ef6787da8e1f4989286d4583d /ext/node | |
parent | 167f674c7cbb9632000c1feb0b747ba098b01c12 (diff) |
fix(net): don't try to set nodelay on upgrade streams (#26342)
Fixes https://github.com/denoland/deno/issues/26341.
We try to call `op_set_nodelay` on an `UpgradeStream`, which doesn't
support that operation.
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/http.ts | 4 | ||||
-rw-r--r-- | ext/node/polyfills/internal_binding/tcp_wrap.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index e117a0ec2..20bef3009 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -67,7 +67,7 @@ import { headersEntries } from "ext:deno_fetch/20_headers.js"; import { timerId } from "ext:deno_web/03_abort_signal.js"; import { clearTimeout as webClearTimeout } from "ext:deno_web/02_timers.js"; import { resourceForReadableStream } from "ext:deno_web/06_streams.js"; -import { TcpConn } from "ext:deno_net/01_net.js"; +import { UpgradedConn } from "ext:deno_net/01_net.js"; import { STATUS_CODES } from "node:_http_server"; import { methods as METHODS } from "node:_http_common"; @@ -517,7 +517,7 @@ class ClientRequest extends OutgoingMessage { ); assert(typeof res.remoteAddrIp !== "undefined"); assert(typeof res.remoteAddrIp !== "undefined"); - const conn = new TcpConn( + const conn = new UpgradedConn( upgradeRid, { transport: "tcp", diff --git a/ext/node/polyfills/internal_binding/tcp_wrap.ts b/ext/node/polyfills/internal_binding/tcp_wrap.ts index 1321cc627..2856f808a 100644 --- a/ext/node/polyfills/internal_binding/tcp_wrap.ts +++ b/ext/node/polyfills/internal_binding/tcp_wrap.ts @@ -300,7 +300,9 @@ export class TCP extends ConnectionWrap { * @return An error status code. */ setNoDelay(noDelay: boolean): number { - this[kStreamBaseField].setNoDelay(noDelay); + if ("setNoDelay" in this[kStreamBaseField]) { + this[kStreamBaseField].setNoDelay(noDelay); + } return 0; } |