summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2022-03-16 14:54:18 +0100
committerGitHub <noreply@github.com>2022-03-16 14:54:18 +0100
commitc5270abad7c42968dcbdbc8d9f09d7675fb843e9 (patch)
tree7e7ff9b63b7cd3420295d5e546dcd987ed746d7d /runtime/js
parent89a41d0a67c531d937126bbdb095ab1edb5eede2 (diff)
feat(unstable): Add Deno.upgradeHttp API (#13618)
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 <crowlkats@toaxl.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org> Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_http.js2
-rw-r--r--runtime/js/90_deno_ns.js1
2 files changed, 2 insertions, 1 deletions
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,