Skip to content

Commit

Permalink
Add proxy_cacert support
Browse files Browse the repository at this point in the history
This completes the bindings for proxy SSL options and fixes #160.
  • Loading branch information
sagebind committed Jun 30, 2020
1 parent 7087375 commit bbdc802
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ pub const CURLOPT_SSL_OPTIONS: CURLoption = CURLOPTTYPE_LONG + 216;
pub const CURLOPT_UNIX_SOCKET_PATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 231;
pub const CURLOPT_PIPEWAIT: CURLoption = CURLOPTTYPE_LONG + 237;
pub const CURLOPT_PROXY_CAINFO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 246;
pub const CURLOPT_PROXY_CAPATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 247;
pub const CURLOPT_PROXY_SSLCERT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 254;
pub const CURLOPT_PROXY_SSLKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 256;

Expand Down
5 changes: 5 additions & 0 deletions src/easy/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ impl Easy {
self.inner.proxy_cainfo(cainfo)
}

/// Same as [`Easy2::proxy_capath`](struct.Easy2.html#method.proxy_capath)
pub fn proxy_capath<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
self.inner.proxy_capath(path)
}

/// Same as [`Easy2::proxy_sslcert`](struct.Easy2.html#method.proxy_sslcert)
pub fn proxy_sslcert(&mut self, sslcert: &str) -> Result<(), Error> {
self.inner.proxy_sslcert(sslcert)
Expand Down
13 changes: 13 additions & 0 deletions src/easy/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,19 @@ impl<H> Easy2<H> {
self.setopt_str(curl_sys::CURLOPT_PROXY_CAINFO, &cainfo)
}

/// Specify a directory holding proxy CA certificates for proxy.
///
/// The specified directory should hold multiple CA certificates to verify
/// the HTTPS proxy with. If libcurl is built against OpenSSL, the
/// certificate directory must be prepared using the OpenSSL `c_rehash`
/// utility.
///
/// By default this value is not set and corresponds to
/// `CURLOPT_PROXY_CAPATH`.
pub fn proxy_capath<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
self.setopt_path(curl_sys::CURLOPT_PROXY_CAPATH, path.as_ref())
}

/// Set client certificate for proxy
///
/// By default this value is not set and corresponds to `CURLOPT_PROXY_SSLCERT`.
Expand Down

0 comments on commit bbdc802

Please sign in to comment.