Added ability to specify SSL certificate in DER format (fixes #67).

This commit is contained in:
Aaron Weiss 2017-06-21 23:21:03 -04:00
parent c0af567258
commit 254f5bb048
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
2 changed files with 20 additions and 2 deletions

View file

@ -33,6 +33,8 @@ pub struct Config {
/// Whether or not to use SSL.
/// Clients will automatically panic if this is enabled without SSL support.
pub use_ssl: Option<bool>,
/// The path to the SSL certificate for this server in DER format.
pub cert_path: Option<String>,
/// The encoding type used for this connection.
/// This is typically UTF-8, but could be something else.
pub encoding: Option<String>,
@ -176,6 +178,11 @@ impl Config {
self.use_ssl.as_ref().cloned().unwrap_or(false)
}
/// Gets the path to the SSL certificate in DER format if specified.
pub fn cert_path(&self) -> Option<&str> {
self.cert_path.as_ref().map(|s| &s[..])
}
/// Gets the encoding to use for this connection. This requires the encode feature to work.
/// This defaults to UTF-8 when not specified.
pub fn encoding(&self) -> &str {