Skip to content

Commit a6cd7db

Browse files
author
Guanqun Lu
committed
enhance 'ssl_version' to be able to set max version as well
1 parent 20162df commit a6cd7db

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/easy/handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ impl Easy {
949949
}
950950

951951
/// Same as [`Easy2::ssl_version`](struct.Easy2.html#method.ssl_version)
952-
pub fn ssl_version(&mut self, version: SslVersion) -> Result<(), Error> {
953-
self.inner.ssl_version(version)
952+
pub fn ssl_version(&mut self, min_version: SslVersion, max_version: SslVersion) -> Result<(), Error> {
953+
self.inner.ssl_version(min_version, max_version)
954954
}
955955

956956
/// Same as [`Easy2::ssl_verify_host`](struct.Easy2.html#method.ssl_verify_host)

src/easy/handler.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ pub enum HttpVersion {
467467
__Nonexhaustive = 500,
468468
}
469469

470-
/// Possible values to pass to the `ip_resolve` method.
470+
/// Possible values to pass to the `ssl_version` method.
471471
#[allow(missing_docs)]
472472
#[derive(Debug)]
473473
pub enum SslVersion {
@@ -1949,8 +1949,9 @@ impl<H> Easy2<H> {
19491949
///
19501950
/// By default this option is not set and corresponds to
19511951
/// `CURLOPT_SSLVERSION`.
1952-
pub fn ssl_version(&mut self, version: SslVersion) -> Result<(), Error> {
1953-
self.setopt_long(curl_sys::CURLOPT_SSLVERSION, version as c_long)
1952+
pub fn ssl_version(&mut self, min_version: SslVersion, max_version: SslVersion) -> Result<(), Error> {
1953+
let version = (min_version as c_long) | ((max_version as c_long) << 16);
1954+
self.setopt_long(curl_sys::CURLOPT_SSLVERSION, version)
19541955
}
19551956

19561957
/// Verify the certificate's name against host.

0 commit comments

Comments
 (0)