summaryrefslogtreecommitdiff
path: root/cli/bench/testdata/deno_upgrade_http.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-08-18 17:35:02 +0530
committerGitHub <noreply@github.com>2022-08-18 17:35:02 +0530
commitcd21cff29942f24ba7d38287186cce64d0e84e56 (patch)
treee663eff884526ee762ae9141a3cf5a0f6967a84e /cli/bench/testdata/deno_upgrade_http.js
parent0b0843e4a54d7c1ddf293ac1ccee2479b69a5ba9 (diff)
feat(ext/flash): An optimized http/1.1 server (#15405)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/bench/testdata/deno_upgrade_http.js')
-rw-r--r--cli/bench/testdata/deno_upgrade_http.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/bench/testdata/deno_upgrade_http.js b/cli/bench/testdata/deno_upgrade_http.js
new file mode 100644
index 000000000..638761cf6
--- /dev/null
+++ b/cli/bench/testdata/deno_upgrade_http.js
@@ -0,0 +1,13 @@
+const { serve, upgradeHttp } = Deno;
+const u8 = Deno.core.encode("HTTP/1.1 101 Switching Protocols\r\n\r\n");
+
+async function handler(req) {
+ const [conn, _firstPacket] = upgradeHttp(req);
+ await conn.write(u8);
+ await conn.close();
+}
+
+serve(handler, {
+ hostname: "127.0.0.1",
+ port: 9000,
+});