From c5270abad7c42968dcbdbc8d9f09d7675fb843e9 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 16 Mar 2022 14:54:18 +0100 Subject: feat(unstable): Add Deno.upgradeHttp API (#13618) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds "Deno.upgradeHttp" API, which allows to "hijack" connection and switch protocols, to eg. implement WebSocket required for Node compat. Co-authored-by: crowlkats Co-authored-by: Ryan Dahl Co-authored-by: Bartek IwaƄczuk --- runtime/js/40_http.js | 2 +- runtime/js/90_deno_ns.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/js') diff --git a/runtime/js/40_http.js b/runtime/js/40_http.js index 9afca0f5b..4a8743438 100644 --- a/runtime/js/40_http.js +++ b/runtime/js/40_http.js @@ -7,7 +7,7 @@ function serveHttp(conn) { const rid = core.opSync("op_http_start", conn.rid); - return new HttpConn(rid); + return new HttpConn(rid, conn.remoteAddr, conn.localAddr); } window.__bootstrap.http.serveHttp = serveHttp; diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 5298d0a69..7ab0108a8 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -109,6 +109,7 @@ serveHttp: __bootstrap.http.serveHttp, resolveDns: __bootstrap.net.resolveDns, upgradeWebSocket: __bootstrap.http.upgradeWebSocket, + upgradeHttp: __bootstrap.http.upgradeHttp, kill: __bootstrap.process.kill, addSignalListener: __bootstrap.signals.addSignalListener, removeSignalListener: __bootstrap.signals.removeSignalListener, -- cgit v1.2.3