Skip to content

Commit 204c3bf

Browse files
authored
Expose proxy-specific SSL options (#453)
* Expose proxy-specific SSL options Expose proxy-specific versions of various SSL options for completeness. Currently we have basically all the SSL options exposed, but only a few of the proxy-specific versions. * Make rustfmt happy * Make rustfmt happy
1 parent 2dee20b commit 204c3bf

File tree

4 files changed

+301
-17
lines changed

4 files changed

+301
-17
lines changed

curl-sys/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ pub const CURLOPTTYPE_OBJECTPOINT: CURLoption = 10_000;
377377
pub const CURLOPTTYPE_FUNCTIONPOINT: CURLoption = 20_000;
378378
pub const CURLOPTTYPE_OFF_T: CURLoption = 30_000;
379379
pub const CURLOPTTYPE_BLOB: CURLoption = 40_000;
380+
const CURLOPTTYPE_VALUES: CURLoption = CURLOPTTYPE_LONG;
380381

381382
pub const CURLOPT_FILE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 1;
382383
pub const CURLOPT_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 2;
@@ -592,8 +593,17 @@ pub const CURLOPT_PIPEWAIT: CURLoption = CURLOPTTYPE_LONG + 237;
592593
pub const CURLOPT_CONNECT_TO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 243;
593594
pub const CURLOPT_PROXY_CAINFO: CURLoption = CURLOPTTYPE_OBJECTPOINT + 246;
594595
pub const CURLOPT_PROXY_CAPATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 247;
596+
pub const CURLOPT_PROXY_SSL_VERIFYPEER: CURLoption = CURLOPTTYPE_LONG + 248;
597+
pub const CURLOPT_PROXY_SSL_VERIFYHOST: CURLoption = CURLOPTTYPE_LONG + 249;
598+
pub const CURLOPT_PROXY_SSLVERSION: CURLoption = CURLOPTTYPE_VALUES + 250;
595599
pub const CURLOPT_PROXY_SSLCERT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 254;
600+
pub const CURLOPT_PROXY_SSLCERTTYPE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 255;
596601
pub const CURLOPT_PROXY_SSLKEY: CURLoption = CURLOPTTYPE_OBJECTPOINT + 256;
602+
pub const CURLOPT_PROXY_SSLKEYTYPE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 257;
603+
pub const CURLOPT_PROXY_KEYPASSWD: CURLoption = CURLOPTTYPE_OBJECTPOINT + 258;
604+
pub const CURLOPT_PROXY_SSL_CIPHER_LIST: CURLoption = CURLOPTTYPE_OBJECTPOINT + 259;
605+
pub const CURLOPT_PROXY_CRLFILE: CURLoption = CURLOPTTYPE_OBJECTPOINT + 260;
606+
pub const CURLOPT_PROXY_SSL_OPTIONS: CURLoption = CURLOPTTYPE_LONG + 261;
597607

598608
pub const CURLOPT_DOH_URL: CURLoption = CURLOPTTYPE_OBJECTPOINT + 279;
599609
pub const CURLOPT_UPLOAD_BUFFERSIZE: CURLoption = CURLOPTTYPE_LONG + 280;
@@ -608,12 +618,16 @@ pub const CURLOPT_PROXY_SSLCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 293;
608618
pub const CURLOPT_PROXY_SSLKEY_BLOB: CURLoption = CURLOPTTYPE_BLOB + 294;
609619
pub const CURLOPT_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 295;
610620

621+
pub const CURLOPT_PROXY_ISSUERCERT: CURLoption = CURLOPTTYPE_OBJECTPOINT + 296;
622+
pub const CURLOPT_PROXY_ISSUERCERT_BLOB: CURLoption = CURLOPTTYPE_BLOB + 297;
623+
611624
pub const CURLOPT_AWS_SIGV4: CURLoption = CURLOPTTYPE_OBJECTPOINT + 305;
612625

613626
pub const CURLOPT_DOH_SSL_VERIFYPEER: CURLoption = CURLOPTTYPE_LONG + 306;
614627
pub const CURLOPT_DOH_SSL_VERIFYHOST: CURLoption = CURLOPTTYPE_LONG + 307;
615628
pub const CURLOPT_DOH_SSL_VERIFYSTATUS: CURLoption = CURLOPTTYPE_LONG + 308;
616629
pub const CURLOPT_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 309;
630+
pub const CURLOPT_PROXY_CAINFO_BLOB: CURLoption = CURLOPTTYPE_BLOB + 310;
617631

618632
pub const CURL_IPRESOLVE_WHATEVER: c_int = 0;
619633
pub const CURL_IPRESOLVE_V4: c_int = 1;

src/easy/handle.rs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,11 @@ impl Easy {
593593
self.inner.proxy_sslcert(sslcert)
594594
}
595595

596+
/// Same as [`Easy2::proxy_sslcert_type`](struct.Easy2.html#method.proxy_sslcert_type)
597+
pub fn proxy_sslcert_type(&mut self, kind: &str) -> Result<(), Error> {
598+
self.inner.proxy_sslcert_type(kind)
599+
}
600+
596601
/// Same as [`Easy2::proxy_sslcert_blob`](struct.Easy2.html#method.proxy_sslcert_blob)
597602
pub fn proxy_sslcert_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
598603
self.inner.proxy_sslcert_blob(blob)
@@ -603,11 +608,21 @@ impl Easy {
603608
self.inner.proxy_sslkey(sslkey)
604609
}
605610

611+
/// Same as [`Easy2::proxy_sslkey_type`](struct.Easy2.html#method.proxy_sslkey_type)
612+
pub fn proxy_sslkey_type(&mut self, kind: &str) -> Result<(), Error> {
613+
self.inner.proxy_sslkey_type(kind)
614+
}
615+
606616
/// Same as [`Easy2::proxy_sslkey_blob`](struct.Easy2.html#method.proxy_sslkey_blob)
607617
pub fn proxy_sslkey_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
608618
self.inner.proxy_sslkey_blob(blob)
609619
}
610620

621+
/// Same as [`Easy2::proxy_key_password`](struct.Easy2.html#method.proxy_key_password)
622+
pub fn proxy_key_password(&mut self, password: &str) -> Result<(), Error> {
623+
self.inner.proxy_key_password(password)
624+
}
625+
611626
/// Same as [`Easy2::proxy_type`](struct.Easy2.html#method.proxy_type)
612627
pub fn proxy_type(&mut self, kind: ProxyType) -> Result<(), Error> {
613628
self.inner.proxy_type(kind)
@@ -1028,6 +1043,11 @@ impl Easy {
10281043
self.inner.ssl_cainfo_blob(blob)
10291044
}
10301045

1046+
/// Same as [`Easy2::proxy_ssl_cainfo_blob`](struct.Easy2.html#method.proxy_ssl_cainfo_blob)
1047+
pub fn proxy_ssl_cainfo_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
1048+
self.inner.proxy_ssl_cainfo_blob(blob)
1049+
}
1050+
10311051
/// Same as [`Easy2::ssl_engine`](struct.Easy2.html#method.ssl_engine)
10321052
pub fn ssl_engine(&mut self, engine: &str) -> Result<(), Error> {
10331053
self.inner.ssl_engine(engine)
@@ -1048,6 +1068,11 @@ impl Easy {
10481068
self.inner.ssl_version(version)
10491069
}
10501070

1071+
/// Same as [`Easy2::proxy_ssl_version`](struct.Easy2.html#method.proxy_ssl_version)
1072+
pub fn proxy_ssl_version(&mut self, version: SslVersion) -> Result<(), Error> {
1073+
self.inner.proxy_ssl_version(version)
1074+
}
1075+
10511076
/// Same as [`Easy2::ssl_min_max_version`](struct.Easy2.html#method.ssl_min_max_version)
10521077
pub fn ssl_min_max_version(
10531078
&mut self,
@@ -1057,16 +1082,36 @@ impl Easy {
10571082
self.inner.ssl_min_max_version(min_version, max_version)
10581083
}
10591084

1085+
/// Same as [`Easy2::proxy_ssl_min_max_version`](struct.Easy2.html#method.proxy_ssl_min_max_version)
1086+
pub fn proxy_ssl_min_max_version(
1087+
&mut self,
1088+
min_version: SslVersion,
1089+
max_version: SslVersion,
1090+
) -> Result<(), Error> {
1091+
self.inner
1092+
.proxy_ssl_min_max_version(min_version, max_version)
1093+
}
1094+
10601095
/// Same as [`Easy2::ssl_verify_host`](struct.Easy2.html#method.ssl_verify_host)
10611096
pub fn ssl_verify_host(&mut self, verify: bool) -> Result<(), Error> {
10621097
self.inner.ssl_verify_host(verify)
10631098
}
10641099

1100+
/// Same as [`Easy2::proxy_ssl_verify_host`](struct.Easy2.html#method.proxy_ssl_verify_host)
1101+
pub fn proxy_ssl_verify_host(&mut self, verify: bool) -> Result<(), Error> {
1102+
self.inner.proxy_ssl_verify_host(verify)
1103+
}
1104+
10651105
/// Same as [`Easy2::ssl_verify_peer`](struct.Easy2.html#method.ssl_verify_peer)
10661106
pub fn ssl_verify_peer(&mut self, verify: bool) -> Result<(), Error> {
10671107
self.inner.ssl_verify_peer(verify)
10681108
}
10691109

1110+
/// Same as [`Easy2::proxy_ssl_verify_peer`](struct.Easy2.html#method.proxy_ssl_verify_peer)
1111+
pub fn proxy_ssl_verify_peer(&mut self, verify: bool) -> Result<(), Error> {
1112+
self.inner.proxy_ssl_verify_peer(verify)
1113+
}
1114+
10701115
/// Same as [`Easy2::cainfo`](struct.Easy2.html#method.cainfo)
10711116
pub fn cainfo<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
10721117
self.inner.cainfo(path)
@@ -1077,11 +1122,21 @@ impl Easy {
10771122
self.inner.issuer_cert(path)
10781123
}
10791124

1125+
/// Same as [`Easy2::proxy_issuer_cert`](struct.Easy2.html#method.proxy_issuer_cert)
1126+
pub fn proxy_issuer_cert<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
1127+
self.inner.proxy_issuer_cert(path)
1128+
}
1129+
10801130
/// Same as [`Easy2::issuer_cert_blob`](struct.Easy2.html#method.issuer_cert_blob)
10811131
pub fn issuer_cert_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
10821132
self.inner.issuer_cert_blob(blob)
10831133
}
10841134

1135+
/// Same as [`Easy2::proxy_issuer_cert_blob`](struct.Easy2.html#method.proxy_issuer_cert_blob)
1136+
pub fn proxy_issuer_cert_blob(&mut self, blob: &[u8]) -> Result<(), Error> {
1137+
self.inner.proxy_issuer_cert_blob(blob)
1138+
}
1139+
10851140
/// Same as [`Easy2::capath`](struct.Easy2.html#method.capath)
10861141
pub fn capath<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
10871142
self.inner.capath(path)
@@ -1092,6 +1147,11 @@ impl Easy {
10921147
self.inner.crlfile(path)
10931148
}
10941149

1150+
/// Same as [`Easy2::proxy_crlfile`](struct.Easy2.html#method.proxy_crlfile)
1151+
pub fn proxy_crlfile<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error> {
1152+
self.inner.proxy_crlfile(path)
1153+
}
1154+
10951155
/// Same as [`Easy2::certinfo`](struct.Easy2.html#method.certinfo)
10961156
pub fn certinfo(&mut self, enable: bool) -> Result<(), Error> {
10971157
self.inner.certinfo(enable)
@@ -1112,6 +1172,11 @@ impl Easy {
11121172
self.inner.ssl_cipher_list(ciphers)
11131173
}
11141174

1175+
/// Same as [`Easy2::proxy_ssl_cipher_list`](struct.Easy2.html#method.proxy_ssl_cipher_list)
1176+
pub fn proxy_ssl_cipher_list(&mut self, ciphers: &str) -> Result<(), Error> {
1177+
self.inner.proxy_ssl_cipher_list(ciphers)
1178+
}
1179+
11151180
/// Same as [`Easy2::ssl_sessionid_cache`](struct.Easy2.html#method.ssl_sessionid_cache)
11161181
pub fn ssl_sessionid_cache(&mut self, enable: bool) -> Result<(), Error> {
11171182
self.inner.ssl_sessionid_cache(enable)
@@ -1122,6 +1187,11 @@ impl Easy {
11221187
self.inner.ssl_options(bits)
11231188
}
11241189

1190+
/// Same as [`Easy2::proxy_ssl_options`](struct.Easy2.html#method.proxy_ssl_options)
1191+
pub fn proxy_ssl_options(&mut self, bits: &SslOpt) -> Result<(), Error> {
1192+
self.inner.proxy_ssl_options(bits)
1193+
}
1194+
11251195
/// Same as [`Easy2::pinned_public_key`](struct.Easy2.html#method.pinned_public_key)
11261196
pub fn pinned_public_key(&mut self, pubkey: &str) -> Result<(), Error> {
11271197
self.inner.pinned_public_key(pubkey)

0 commit comments

Comments
 (0)