deno/tests
Matt Mastracci 684377c92c
refactor(ext/tls): Implement required functionality for later SNI support (#23686)
Precursor to #23236 

This implements the SNI features, but uses private symbols to avoid
exposing the functionality at this time. Note that to properly test this
feature, we need to add a way for `connectTls` to specify a hostname.
This is something that should be pushed into that API at a later time as
well.

```ts
Deno.test(
  { permissions: { net: true, read: true } },
  async function listenResolver() {
    let sniRequests = [];
    const listener = Deno.listenTls({
      hostname: "localhost",
      port: 0,
      [resolverSymbol]: (sni: string) => {
        sniRequests.push(sni);
        return {
          cert,
          key,
        };
      },
    });

    {
      const conn = await Deno.connectTls({
        hostname: "localhost",
        [serverNameSymbol]: "server-1",
        port: listener.addr.port,
      });
      const [_handshake, serverConn] = await Promise.all([
        conn.handshake(),
        listener.accept(),
      ]);
      conn.close();
      serverConn.close();
    }

    {
      const conn = await Deno.connectTls({
        hostname: "localhost",
        [serverNameSymbol]: "server-2",
        port: listener.addr.port,
      });
      const [_handshake, serverConn] = await Promise.all([
        conn.handshake(),
        listener.accept(),
      ]);
      conn.close();
      serverConn.close();
    }

    assertEquals(sniRequests, ["server-1", "server-2"]);
    listener.close();
  },
);
```

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-05-09 10:54:47 -06:00
..
config chore: move test_util/std to tests/util/std (#22402) 2024-02-13 09:22:49 -07:00
ffi chore: enable clippy::print_stdout and clippy::print_stderr (#23732) 2024-05-08 22:45:06 -04:00
integration refactor(ext/tls): Implement required functionality for later SNI support (#23686) 2024-05-09 10:54:47 -06:00
napi chore: enable clippy::print_stdout and clippy::print_stderr (#23732) 2024-05-08 22:45:06 -04:00
node_compat test: fix node_compat_test (#23446) 2024-04-19 01:42:18 +02:00
registry chore: fix flaky net_listen_allow_localhost_4555 (#23726) 2024-05-07 17:21:56 +00:00
specs fix(task): regression where npx <command> sometimes couldn't find command (#23730) 2024-05-09 03:16:44 +00:00
testdata fix(task): regression where npx <command> sometimes couldn't find command (#23730) 2024-05-09 03:16:44 +00:00
unit refactor(ext/tls): Implement required functionality for later SNI support (#23686) 2024-05-09 10:54:47 -06:00
unit_node fix(ext/node): support delete process.env.var (#23647) 2024-05-02 06:40:22 +00:00
util fix(lsp): move sloppy import resolution from loader to resolver (#23751) 2024-05-09 14:17:31 +00:00
wpt fix: Float16Array support (#23512) 2024-04-23 22:54:19 +02:00
Cargo.toml chore(tests/specs): ability to have sub tests in file (#23667) 2024-05-03 10:19:42 +05:30
lib.rs chore: move cli/tests/ -> tests/ (#22369) 2024-02-10 20:22:13 +00:00
README.md chore: continue tests/ re-org (#22396) 2024-02-12 17:13:14 -07:00

Deno Integration Tests