Skip to content

Could we cache rustls-native-certs::load_native_certs()? #230

@jschwe

Description

@jschwe

When creating a new verifier, on certain OSs, rustls_native_certs::load_native_certs is called, which is documented to be potentially expensive, since it probes for certificates, and loads each file.
Would it be possible to cache the result (static LazyLock), and ideally expose a function to initialize the cache?

let result = rustls_native_certs::load_native_certs();

/// ## Caveats
///
/// This function can be expensive: on some platforms it involves loading
/// and parsing a ~300KB disk file. It's therefore prudent to call
/// this sparingly.

https://github.com/rustls/rustls-native-certs/blob/559fd3d8390da90865693e3b48ae6eef56c4d111/src/lib.rs#L118

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions