Skip to content

Commit 24bba13

Browse files
darkprokobaAndrey Petrov
andauthored
Exposed the CURLOPT_CAINFO_BLOB libcurl option. (#420)
See also https://curl.se/libcurl/c/CURLOPT_CAINFO_BLOB.html Co-authored-by: Andrey Petrov <[email protected]>
1 parent 433fbce commit 24bba13

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

curl-sys/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,8 @@ pub const CURLOPT_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 295;
607607

608608
pub const CURLOPT_AWS_SIGV4: CURLoption = CURLOPTTYPE_OBJECTPOINT + 305;
609609

610+
pub const CURLOPT_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 309;
611+
610612
pub const CURL_IPRESOLVE_WHATEVER: c_int = 0;
611613
pub const CURL_IPRESOLVE_V4: c_int = 1;
612614
pub const CURL_IPRESOLVE_V6: c_int = 2;

src/easy/handle.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,11 @@ impl Easy {
10031003
self.inner.key_password(password)
10041004
}
10051005

1006+
/// Same as [`Easy2::ssl_cainfo_blob`](struct.Easy2.html#method.ssl_cainfo_blob)
1007+
pub fn ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
1008+
self.inner.ssl_cainfo_blob(blob)
1009+
}
1010+
10061011
/// Same as [`Easy2::ssl_engine`](struct.Easy2.html#method.ssl_engine)
10071012
pub fn ssl_engine(&mut self, engine: &str) -> Result<(), Error> {
10081013
self.inner.ssl_engine(engine)

src/easy/handler.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,6 +2073,18 @@ impl<H> Easy2<H> {
20732073
self.setopt_str(curl_sys::CURLOPT_KEYPASSWD, &password)
20742074
}
20752075

2076+
/// Set the SSL Certificate Authorities using an in-memory blob.
2077+
///
2078+
/// The specified byte buffer should contain the binary content of one
2079+
/// or more PEM-encoded CA certificates, which will be copied into
2080+
/// the handle.
2081+
///
2082+
/// By default this option is not set and corresponds to
2083+
/// `CURLOPT_CAINFO_BLOB`.
2084+
pub fn ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
2085+
self.setopt_blob(curl_sys::CURLOPT_CAINFO_BLOB, blob)
2086+
}
2087+
20762088
/// Set the SSL engine identifier.
20772089
///
20782090
/// This will be used as the identifier for the crypto engine you want to

systest/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ fn main() {
6666
if version < 77 {
6767
match s {
6868
"CURLVERSION_TENTH"
69+
| "CURLOPT_CAINFO_BLOB"
6970
| "CURLVERSION_NOW"
7071
| "CURL_VERSION_ALTSVC"
7172
| "CURL_VERSION_ZSTD"

0 commit comments

Comments
 (0)