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

Expose proxy-specific SSL options #453

Merged
merged 3 commits into from
Jul 19, 2022
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
14 changes: 14 additions & 0 deletions curl-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ pub const CURLOPTTYPE_OBJECTPOINT: CURLoption = 10_000;
pub const CURLOPTTYPE_FUNCTIONPOINT: CURLoption = 20_000;
pub const CURLOPTTYPE_OFF_T: CURLoption = 30_000;
pub const CURLOPTTYPE_BLOB: CURLoption = 40_000;
const CURLOPTTYPE_VALUES: CURLoption = CURLOPTTYPE_LONG;

pub const CURLOPT_FILE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 1;
pub const CURLOPT_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 2;
Expand Down Expand Up @@ -592,8 +593,17 @@ pub const CURLOPT_PIPEWAIT: CURLoption = CURLOPTTYPE_LONG + 237;
pub const CURLOPT_CONNECT_TO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 243;
pub const CURLOPT_PROXY_CAINFO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 246;
pub const CURLOPT_PROXY_CAPATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 247;
pub const CURLOPT_PROXY_SSL_VERIFYPEER: CURLoption = CURLOPTTYPE_LONG + 248;
pub const CURLOPT_PROXY_SSL_VERIFYHOST: CURLoption = CURLOPTTYPE_LONG + 249;
pub const CURLOPT_PROXY_SSLVERSION: CURLoption = CURLOPTTYPE_VALUES + 250;
pub const CURLOPT_PROXY_SSLCERT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 254;
pub const CURLOPT_PROXY_SSLCERTTYPE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 255;
pub const CURLOPT_PROXY_SSLKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 256;
pub const CURLOPT_PROXY_SSLKEYTYPE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 257;
pub const CURLOPT_PROXY_KEYPASSWD: CURLoption = CURLOPTTYPE_OBJECTPOINT + 258;
pub const CURLOPT_PROXY_SSL_CIPHER_LIST: CURLoption = CURLOPTTYPE_OBJECTPOINT + 259;
pub const CURLOPT_PROXY_CRLFILE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 260;
pub const CURLOPT_PROXY_SSL_OPTIONS: CURLoption = CURLOPTTYPE_LONG + 261;

pub const CURLOPT_DOH_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 279;
pub const CURLOPT_UPLOAD_BUFFERSIZE: CURLoption = CURLOPTTYPE_LONG + 280;
Expand All @@ -608,12 +618,16 @@ pub const CURLOPT_PROXY_SSLCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 293;
pub const CURLOPT_PROXY_SSLKEY_BLOB: CURLoption = CURLOPTTYPE_BLOB + 294;
pub const CURLOPT_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 295;

pub const CURLOPT_PROXY_ISSUERCERT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 296;
pub const CURLOPT_PROXY_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 297;

pub const CURLOPT_AWS_SIGV4: CURLoption = CURLOPTTYPE_OBJECTPOINT + 305;

pub const CURLOPT_DOH_SSL_VERIFYPEER: CURLoption = CURLOPTTYPE_LONG + 306;
pub const CURLOPT_DOH_SSL_VERIFYHOST: CURLoption = CURLOPTTYPE_LONG + 307;
pub const CURLOPT_DOH_SSL_VERIFYSTATUS: CURLoption = CURLOPTTYPE_LONG + 308;
pub const CURLOPT_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 309;
pub const CURLOPT_PROXY_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 310;

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

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

/// Same as [`Easy2::proxy_sslcert_blob`](struct.Easy2.html#method.proxy_sslcert_blob)
pub fn proxy_sslcert_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
self.inner.proxy_sslcert_blob(blob)
Expand All @@ -603,11 +608,21 @@ impl Easy {
self.inner.proxy_sslkey(sslkey)
}

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

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

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

/// Same as [`Easy2::proxy_type`](struct.Easy2.html#method.proxy_type)
pub fn proxy_type(&mut self, kind: ProxyType) -> Result<(), Error> {
self.inner.proxy_type(kind)
Expand Down Expand Up @@ -1028,6 +1043,11 @@ impl Easy {
self.inner.ssl_cainfo_blob(blob)
}

/// Same as [`Easy2::proxy_ssl_cainfo_blob`](struct.Easy2.html#method.proxy_ssl_cainfo_blob)
pub fn proxy_ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
self.inner.proxy_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 All @@ -1048,6 +1068,11 @@ impl Easy {
self.inner.ssl_version(version)
}

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

/// Same as [`Easy2::ssl_min_max_version`](struct.Easy2.html#method.ssl_min_max_version)
pub fn ssl_min_max_version(
&mut self,
Expand All @@ -1057,16 +1082,36 @@ impl Easy {
self.inner.ssl_min_max_version(min_version, max_version)
}

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

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

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

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

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

/// Same as [`Easy2::cainfo`](struct.Easy2.html#method.cainfo)
pub fn cainfo<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
self.inner.cainfo(path)
Expand All @@ -1077,11 +1122,21 @@ impl Easy {
self.inner.issuer_cert(path)
}

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

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

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

/// Same as [`Easy2::capath`](struct.Easy2.html#method.capath)
pub fn capath<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
self.inner.capath(path)
Expand All @@ -1092,6 +1147,11 @@ impl Easy {
self.inner.crlfile(path)
}

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

/// Same as [`Easy2::certinfo`](struct.Easy2.html#method.certinfo)
pub fn certinfo(&mut self, enable: bool) -> Result<(), Error> {
self.inner.certinfo(enable)
Expand All @@ -1112,6 +1172,11 @@ impl Easy {
self.inner.ssl_cipher_list(ciphers)
}

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

/// Same as [`Easy2::ssl_sessionid_cache`](struct.Easy2.html#method.ssl_sessionid_cache)
pub fn ssl_sessionid_cache(&mut self, enable: bool) -> Result<(), Error> {
self.inner.ssl_sessionid_cache(enable)
Expand All @@ -1122,6 +1187,11 @@ impl Easy {
self.inner.ssl_options(bits)
}

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

/// Same as [`Easy2::pinned_public_key`](struct.Easy2.html#method.pinned_public_key)
pub fn pinned_public_key(&mut self, pubkey: &str) -> Result<(), Error> {
self.inner.pinned_public_key(pubkey)
Expand Down
Loading