aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2018-01-11 17:33:31 -0800
committerGitHub <[email protected]>2018-01-11 17:33:31 -0800
commit8ee891fcbf4734f85ad8cbab6fa26adabfe14f90 (patch)
tree534553c2fd05e6b873c50eb4e94e52b8bf133681
parentRelease openssl v0.10.1 (diff)
parentAdd setters to ConnectConfiguration (diff)
downloadrust-openssl-8ee891fcbf4734f85ad8cbab6fa26adabfe14f90.tar.xz
rust-openssl-8ee891fcbf4734f85ad8cbab6fa26adabfe14f90.zip
Merge pull request #826 from sfackler/conf-setters
Add setters to ConnectConfiguration
-rw-r--r--CHANGELOG.md8
-rw-r--r--openssl/src/ssl/connector.rs16
2 files changed, 20 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53213ba5..c90b5590 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
## [Unreleased]
+### Added
+
+* Added `ConnectConfiguration::set_use_server_name_indication` and
+ `ConnectConfiguration::set_verify_hostname` for use in contexts where you don't have ownership
+ of the `ConnectConfiguration`.
+
## [v0.10.1] - 2018-01-10
### Added
@@ -74,4 +80,4 @@ Look at the [release tags] for information about older releases.
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.1...master
[v0.10.1]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.0...openssl-v0.10.1
[v0.10.0]: https://github.com/sfackler/rust-openssl/compare/v0.9.23...openssl-v0.10.0
-[release tags]: https://github.com/sfackler/rust-openssl/releases \ No newline at end of file
+[release tags]: https://github.com/sfackler/rust-openssl/releases
diff --git a/openssl/src/ssl/connector.rs b/openssl/src/ssl/connector.rs
index 54910733..9e485ab9 100644
--- a/openssl/src/ssl/connector.rs
+++ b/openssl/src/ssl/connector.rs
@@ -124,11 +124,22 @@ pub struct ConnectConfiguration {
}
impl ConnectConfiguration {
+ /// A builder-style version of `set_use_server_name_indication`.
+ pub fn use_server_name_indication(mut self, use_sni: bool) -> ConnectConfiguration {
+ self.set_use_server_name_indication(use_sni);
+ self
+ }
+
/// Configures the use of Server Name Indication (SNI) when connecting.
///
/// Defaults to `true`.
- pub fn use_server_name_indication(mut self, use_sni: bool) -> ConnectConfiguration {
+ pub fn set_use_server_name_indication(&mut self, use_sni: bool) {
self.sni = use_sni;
+ }
+
+ /// A builder-style version of `set_verify_hostname`.
+ pub fn verify_hostname(mut self, verify_hostname: bool) -> ConnectConfiguration {
+ self.set_verify_hostname(verify_hostname);
self
}
@@ -141,9 +152,8 @@ impl ConnectConfiguration {
/// You should think very carefully before you use this method. If hostname verification is not
/// used, *any* valid certificate for *any* site will be trusted for use from any other. This
/// introduces a significant vulnerability to man-in-the-middle attacks.
- pub fn verify_hostname(mut self, verify_hostname: bool) -> ConnectConfiguration {
+ pub fn set_verify_hostname(&mut self, verify_hostname: bool) {
self.verify_hostname = verify_hostname;
- self
}
/// Initiates a client-side TLS session on a stream.