Skip to content

Exposing SslContext for flexibility (e.g. client-side certs, etc) #471

@mikedilger

Description

@mikedilger

Currently, net::HttpListener::https() takes a certificate and a key, and sets up an SslContext with a lot of assumptions. For example, it sets the DEFAULT cipher list. It also sets SSL_VERIFY_NONE.
This is called by Server::listen_threads(). I'm trying to make changes that allow the caller to pass in an SslContext.

Currently the SSL configuration is declared when the Server is created, by passing a certificate and a key to Server::https(). Unfortunately this scheme will not direclty work with a passed in SslContext, because if an SslContext is setup in the Server struct, it moves when passed on to HttpListener::https(), causing a "use of partially moved value" error. This cannot be solved via clone() because SslContext does not implement clone().

If Server::listen_threads() accepted the SSL information at that point (rather than owning it in it's struct), this would cause a lot of breaking changes.

OTOH, If HttpListener kept a reference to an SslContext (instead of owning it), it would propagate another annoying lifetime parameter over a lot of code.

I don't see a clearly preferable way of implementing this. Given a preferred direction, I'd be happy to make the changes necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions