diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-08-11 17:27:41 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-11 11:57:41 +0000 |
commit | 33dc5d262288f4efae3077978f37f22338568b35 (patch) | |
tree | d4fdc4b6d9c7a6ab775754f5c1b923e5da04d7ab /cli/tests/unit_node/tls_test.ts | |
parent | 2f00b0add476bb151bc3a713da165296906cfc2a (diff) |
fix(node): implement TLSSocket._start (#20120)
Closes https://github.com/denoland/deno/issues/19983
Closes https://github.com/denoland/deno/issues/18303
Closes https://github.com/denoland/deno/issues/16681
Closes https://github.com/denoland/deno/issues/19978
Diffstat (limited to 'cli/tests/unit_node/tls_test.ts')
-rw-r--r-- | cli/tests/unit_node/tls_test.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cli/tests/unit_node/tls_test.ts b/cli/tests/unit_node/tls_test.ts index 79c1e634c..7a270c60b 100644 --- a/cli/tests/unit_node/tls_test.ts +++ b/cli/tests/unit_node/tls_test.ts @@ -56,6 +56,38 @@ Connection: close await serve; }); +// https://github.com/denoland/deno/pull/20120 +Deno.test("tls.connect mid-read tcp->tls upgrade", async () => { + const ctl = new AbortController(); + const serve = serveTls(() => new Response("hello"), { + port: 8443, + key, + cert, + signal: ctl.signal, + }); + + await delay(200); + + const conn = tls.connect({ + host: "localhost", + port: 8443, + secureContext: { + ca: rootCaCert, + // deno-lint-ignore no-explicit-any + } as any, + }); + + conn.setEncoding("utf8"); + conn.write(`GET / HTTP/1.1\nHost: www.google.com\n\n`); + + conn.on("data", (_) => { + conn.destroy(); + ctl.abort(); + }); + + await serve; +}); + Deno.test("tls.createServer creates a TLS server", async () => { const p = deferred(); const server = tls.createServer( |