1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/ext/fetch
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
..
20_headers.js refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
21_formdata.js chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
22_body.js refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
22_http_client.js feat(ext/net): extract TLS key and certificate from interfaces (#23327) 2024-04-18 11:21:08 -06:00
23_request.js fix(ext/http): ensure signal is created iff requested (#23601) 2024-04-29 09:40:02 -06:00
23_response.js chore: replace 'call' to 'execute' in error messages (#22579) 2024-03-10 02:23:14 +00:00
26_fetch.js fix(ext/fetch): make EventSource more robust (#22493) 2024-03-24 18:49:01 +01:00
27_eventsource.js fix(ext/fetch): do not truncate field value in EventSource (#22368) 2024-03-25 07:31:13 -07:00
Cargo.toml chore: forward v1.43.2 release commit to main (#23749) 2024-05-09 00:45:01 +00:00
fs_fetch_handler.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
internal.d.ts perf(ext/http): recover memory for serve and optimize AbortController (#23559) 2024-04-25 14:52:24 -04:00
lib.deno_fetch.d.ts docs: update categories to match new planned sitemap (#23677) 2024-05-05 18:56:55 -07:00
lib.rs refactor(ext/tls): Implement required functionality for later SNI support (#23686) 2024-05-09 10:54:47 -06:00
README.md Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00

deno_fetch

This crate implements the Fetch API.

Spec: https://fetch.spec.whatwg.org/