• v2.17.0 438f0bf119

    v2.17.0
    All checks were successful
    release / build-and-release (push) Successful in 24s
    Stable

    littleisland released this 2026-11-07 02:07:34 +00:00 | 84 commits to main since this release

    NOE v2.17.0

    This release adds HTTPS listeners and WSS upgrades to noe:http, sharing the
    existing HTTP/1.1 server, WebSocket transport, grants, and resource ownership.
    No dependency changes are required.

    HTTPS and WSS

    Pass certificate and private-key PEM text to serve:

    import {readFile} from "noe:fs";
    import {serve, upgradeWebSocket} from "noe:http";
    
    const server = serve({
      hostname: "127.0.0.1",
      port: 8443,
      cert: await readFile("server-cert.pem", "utf8"),
      key: await readFile("server-key.pem", "utf8"),
    }, request => {
      if (new URL(request.url).pathname === "/ws") {
        const {socket, response} = upgradeWebSocket(request);
        socket.onmessage = event => socket.send(event.data);
        return response;
      }
      return Response.json({url: request.url});
    });
    console.log(server.url); // https://127.0.0.1:8443
    

    Both options must be nonempty strings. cert accepts a concatenated PEM
    certificate chain. Supplying only one option, null/non-string values, malformed
    PEM, or a mismatched pair throws TypeError synchronously before bind
    authorization or opening a listener.
    Diagnostics omit the supplied certificate and private-key text.

    These options contain PEM data, not file paths. File reads remain explicit
    noe:fs operations under the selected Root/Cwd/ReadOnly settings. Inline TLS
    does not grant filesystem, Fetch, or WebSocket access. serve requires Serve;
    upgradeWebSocket requires both Serve and WebSockets.

    Server URLs and incoming HTTPS Request URLs use https://. Clients connect
    to the corresponding wss:// URL for WebSockets. TLS listeners use HTTP/1.1;
    HTTP/2 and automatic certificate issuance/reload are outside this addition.
    Outgoing Fetch and WebSocket trust configurations remain independent.

    See the runnable HTTPS/WSS example
    and full listener contract.

    Go embedding and compatibility

    Go hosts may select HTTPS with stdlib.ServeOptions.TLS *tls.Config instead
    of exposing private keys to JavaScript. A non-nil configuration must supply
    Certificates, GetCertificate, or GetConfigForClient. JavaScript cert/key
    options conflict with host TLS and cannot override its policy.

    profile.Modules.Serve = &stdlib.ServeOptions{
        Allow: func(address string) error { return nil }, // Set the host's bind policy.
        TLS: &tls.Config{Certificates: []tls.Certificate{certificate}},
    }
    

    This fragment uses crypto/tls and a previously loaded tls.Certificate.
    Profile/runtime/Worker/listener copies clone the TLS configuration. Referenced
    certificate/key objects, pools, and callbacks remain shared and immutable in
    use. Callback-selected configurations are cloned and advertise HTTP/1.1
    without changing the caller's configuration.

    Go source compatibility: the new field changes the exported ServeOptions
    struct shape. External unkeyed literals must use named fields. Existing keyed
    literals, JavaScript HTTP calls without TLS options, capability selection,
    and the public /v2 module path remain supported.

    Cleanup and verification

    HTTPS uses the same body limits, handler admission, asynchronous idempotent
    close, async disposal, five-second graceful allowance, and forced runtime/
    Worker teardown as HTTP. Forced cleanup also interrupts stalled TLS
    handshakes. Upgraded sockets keep their own lifetime; closing the listener
    does not close them.

    Implementation verification covers HTTPS/HTTP and WSS data/close exchange,
    validation before authorization/bind, host policy and runtime snapshots,
    callback ALPN, Worker inheritance/termination, stalled-handshake cleanup,
    race detection, the real CLI example, types, and public module consumers.
    Consumers run with CGO disabled against both the checkout and an isolated
    module artifact and build for all six distribution targets. An existing
    WebSocket regression test now synchronizes its handshake response so owner
    job delivery cannot invalidate its opening-only wait; socket behavior is
    unchanged by that test correction.

    Release preparation reuses unchanged implementation evidence. CI builds the
    six CGO-disabled binaries, creates SHA256SUMS, and publishes the selected
    immutable tag without repeating local source suites. Native execution is
    verified on Linux amd64; other targets receive build/checksum verification.
    Go 1.27.2, go-quickjs v0.32.0, go-intl v0.8.0, and disabled JIT remain selected.
    See the release checkpoints for preparation and
    publication status. Binary installation and running-service restarts are
    separate actions.

    Downloads