georust / netcdf

High-level netCDF bindings for Rust
Apache License 2.0
81 stars 28 forks source link

Allow user to set CAPATH/CAINFO #144

Closed mulimoen closed 2 months ago

mulimoen commented 2 months ago

This let's one set the certificate for curl, as this is not done by default. The certificate can be set either programatically by the safe wrapper

    netcdf::rc::set("HTTP.SSL.CAPATH", "/etc/ssl/certs/").unwrap();

by using the unsafe c-function

    unsafe {
        let path = c"HTTP.SSL.CAPATH";
        let value = c"/etc/ssl/certs/";
        let ret = netcdf_sys::nc_rc_set(path.as_ptr(), value.as_ptr());
        assert_eq!(ret, 0);
    }

or by setting the information in ~/.ncrc:

HTTP.SSL.CAPATH=/etc/ssl/certs/

Fixes #141