Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed the CURLOPT_CAINFO_BLOB libcurl option. #420

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ pub const CURLOPT_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 295;

pub const CURLOPT_AWS_SIGV4: CURLoption = CURLOPTTYPE_OBJECTPOINT + 305;

pub const CURLOPT_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 309;

pub const CURL_IPRESOLVE_WHATEVER: c_int = 0;
pub const CURL_IPRESOLVE_V4: c_int = 1;
pub const CURL_IPRESOLVE_V6: c_int = 2;
Expand Down
5 changes: 5 additions & 0 deletions src/easy/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,11 @@ impl Easy {
self.inner.key_password(password)
}

/// Same as [`Easy2::ssl_cainfo_blob`](struct.Easy2.html#method.ssl_cainfo_blob)
pub fn ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
self.inner.ssl_cainfo_blob(blob)
}

/// Same as [`Easy2::ssl_engine`](struct.Easy2.html#method.ssl_engine)
pub fn ssl_engine(&mut self, engine: &str) -> Result<(), Error> {
self.inner.ssl_engine(engine)
Expand Down
12 changes: 12 additions & 0 deletions src/easy/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,18 @@ impl<H> Easy2<H> {
self.setopt_str(curl_sys::CURLOPT_KEYPASSWD, &password)
}

/// Set the SSL Certificate Authorities using an in-memory blob.
///
/// The specified byte buffer should contain the binary content of one
/// or more PEM-encoded CA certificates, which will be copied into
/// the handle.
///
/// By default this option is not set and corresponds to
/// `CURLOPT_CAINFO_BLOB`.
pub fn ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
self.setopt_blob(curl_sys::CURLOPT_CAINFO_BLOB, blob)
}

/// Set the SSL engine identifier.
///
/// This will be used as the identifier for the crypto engine you want to
Expand Down
1 change: 1 addition & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ fn main() {
if version < 77 {
match s {
"CURLVERSION_TENTH"
| "CURLOPT_CAINFO_BLOB"
| "CURLVERSION_NOW"
| "CURL_VERSION_ALTSVC"
| "CURL_VERSION_ZSTD"
Expand Down