Skip to content

Commit 56e8e8d

Browse files
committed
Don't require ssl_ctx callback is called
1 parent 34d7000 commit 56e8e8d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/easy/handler.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ pub trait Handler {
250250
/// By default this function calls an internal method and
251251
/// corresponds to `CURLOPT_SSL_CTX_FUNCTION` and
252252
/// `CURLOPT_SSL_CTX_DATA`.
253+
///
254+
/// Note that this callback is not guaranteed to be called, not all versions
255+
/// of libcurl support calling this callback.
253256
fn ssl_ctx(&mut self, cx: *mut c_void) -> Result<(), Error> {
254257
drop(cx);
255258
Ok(())
@@ -632,10 +635,8 @@ impl<H: Handler> Easy2<H> {
632635
.expect("failed to set debug callback");
633636

634637
let cb: curl_sys::curl_ssl_ctx_callback = ssl_ctx_cb::<H>;
635-
self.setopt_ptr(curl_sys::CURLOPT_SSL_CTX_FUNCTION, cb as *const _)
636-
.expect("failed to set ssl ctx callback");
637-
self.setopt_ptr(curl_sys::CURLOPT_SSL_CTX_DATA, ptr)
638-
.expect("failed to set ssl ctx callback");
638+
drop(self.setopt_ptr(curl_sys::CURLOPT_SSL_CTX_FUNCTION, cb as *const _));
639+
drop(self.setopt_ptr(curl_sys::CURLOPT_SSL_CTX_DATA, ptr));
639640
}
640641

641642
#[cfg(all(unix, not(target_os = "macos")))]

0 commit comments

Comments
 (0)