Skip to content

Commit

Permalink
feat: Add verify_ssl field to gix-transport Options which is used to …
Browse files Browse the repository at this point in the history
…disable SSL verification.

Currently this option only works in the curl backend.
  • Loading branch information
Alvenix authored and Abdullah Alyan committed Nov 29, 2023
1 parent 5d8b5f4 commit 08d36f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gix-transport/src/client/blocking_io/http/curl/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ pub fn new() -> (
verbose,
ssl_ca_info,
ssl_version,
ssl_verify,
http_version,
backend,
},
Expand Down Expand Up @@ -194,6 +195,8 @@ pub fn new() -> (
}
}

handle.ssl_verify_peer(ssl_verify)?;

if let Some(http_version) = http_version {
let version = match http_version {
HttpVersion::V1_1 => curl::easy::HttpVersion::V11,
Expand Down
4 changes: 4 additions & 0 deletions gix-transport/src/client/blocking_io/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ pub struct Options {
pub ssl_ca_info: Option<PathBuf>,
/// The SSL version or version range to use, or `None` to let the TLS backend determine which versions are acceptable.
pub ssl_version: Option<SslVersionRangeInclusive>,
/// Controls whether to perform SSL identity verification or not. Turning this off is not recommended and can lead to
/// various security risks. An example where this may be needed is when an internal git server uses a self-signed
/// certificate and the user accepts the associated security risks.
pub ssl_verify: bool,
/// The HTTP version to enforce. If unset, it is implementation defined.
pub http_version: Option<HttpVersion>,
/// Backend specific options, if available.
Expand Down

0 comments on commit 08d36f6

Please sign in to comment.