Commit d032d31a authored by Marc Gravell's avatar Marc Gravell

UseSsl => Ssl for consistency

parent 6facc80c
...@@ -49,7 +49,7 @@ public void ConfigManualWithDefaultPorts(string host, int port, bool useSsl, int ...@@ -49,7 +49,7 @@ public void ConfigManualWithDefaultPorts(string host, int port, bool useSsl, int
{ {
options.EndPoints.Add(host, port); options.EndPoints.Add(host, port);
} }
if (useSsl) options.UseSsl = true; if (useSsl) options.Ssl = true;
options.SetDefaultPorts(); // normally it is the multiplexer that calls this, not us options.SetDefaultPorts(); // normally it is the multiplexer that calls this, not us
Assert.AreEqual(expectedPort, ((DnsEndPoint)options.EndPoints.Single()).Port); Assert.AreEqual(expectedPort, ((DnsEndPoint)options.EndPoints.Single()).Port);
......
...@@ -40,7 +40,7 @@ public void ConnectToSSLServer(bool useSsl, bool specifyHost) ...@@ -40,7 +40,7 @@ public void ConnectToSSLServer(bool useSsl, bool specifyHost)
}; };
if(useSsl) if(useSsl)
{ {
config.UseSsl = useSsl; config.Ssl = useSsl;
if (specifyHost) if (specifyHost)
{ {
config.SslHost = host; config.SslHost = host;
...@@ -146,7 +146,7 @@ public void RedisLabsSSL() ...@@ -146,7 +146,7 @@ public void RedisLabsSSL()
#if LOGOUTPUT #if LOGOUTPUT
ConnectionMultiplexer.EchoPath = Me(); ConnectionMultiplexer.EchoPath = Me();
#endif #endif
options.UseSsl = true; options.Ssl = true;
options.CertificateSelection += delegate { options.CertificateSelection += delegate {
return new X509Certificate2(pfxPath, ""); return new X509Certificate2(pfxPath, "");
}; };
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Net.Security; using System.Net.Security;
...@@ -34,13 +35,13 @@ public sealed class ConfigurationOptions : ICloneable ...@@ -34,13 +35,13 @@ public sealed class ConfigurationOptions : ICloneable
private const string AllowAdminPrefix = "allowAdmin=", SyncTimeoutPrefix = "syncTimeout=", private const string AllowAdminPrefix = "allowAdmin=", SyncTimeoutPrefix = "syncTimeout=",
ServiceNamePrefix = "serviceName=", ClientNamePrefix = "name=", KeepAlivePrefix = "keepAlive=", ServiceNamePrefix = "serviceName=", ClientNamePrefix = "name=", KeepAlivePrefix = "keepAlive=",
VersionPrefix = "version=", ConnectTimeoutPrefix = "connectTimeout=", PasswordPrefix = "password=", VersionPrefix = "version=", ConnectTimeoutPrefix = "connectTimeout=", PasswordPrefix = "password=",
TieBreakerPrefix = "tiebreaker=", WriteBufferPrefix = "writeBuffer=", UseSslPrefix = "ssl=", SslHostPrefix = "sslHost=", TieBreakerPrefix = "tiebreaker=", WriteBufferPrefix = "writeBuffer=", sslPrefix = "ssl=", SslHostPrefix = "sslHost=",
ConfigChannelPrefix = "configChannel=", AbortOnConnectFailPrefix = "abortConnect=", ResolveDnsPrefix = "resolveDns=", ConfigChannelPrefix = "configChannel=", AbortOnConnectFailPrefix = "abortConnect=", ResolveDnsPrefix = "resolveDns=",
ChannelPrefixPrefix = "channelPrefix=", ProxyPrefix = "proxy="; ChannelPrefixPrefix = "channelPrefix=", ProxyPrefix = "proxy=";
private readonly EndPointCollection endpoints = new EndPointCollection(); private readonly EndPointCollection endpoints = new EndPointCollection();
private bool? allowAdmin, abortOnConnectFail, resolveDns, useSsl; private bool? allowAdmin, abortOnConnectFail, resolveDns, ssl;
private string clientName, serviceName, password, tieBreaker, sslHost, configChannel; private string clientName, serviceName, password, tieBreaker, sslHost, configChannel;
...@@ -79,7 +80,13 @@ public sealed class ConfigurationOptions : ICloneable ...@@ -79,7 +80,13 @@ public sealed class ConfigurationOptions : ICloneable
/// <summary> /// <summary>
/// Indicates whether the connection should be encrypted /// Indicates whether the connection should be encrypted
/// </summary> /// </summary>
public bool UseSsl { get { return useSsl.GetValueOrDefault(); } set { useSsl = value; } } [Obsolete("Please use .Ssl instead of .UseSsl"), Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public bool UseSsl { get { return Ssl; } set { Ssl = value; } }
/// <summary>
/// Indicates whether the connection should be encrypted
/// </summary>
public bool Ssl { get { return ssl.GetValueOrDefault(); } set { ssl = value; } }
/// <summary> /// <summary>
/// Automatically encodes and decodes channels /// Automatically encodes and decodes channels
...@@ -213,7 +220,7 @@ public ConfigurationOptions Clone() ...@@ -213,7 +220,7 @@ public ConfigurationOptions Clone()
password = password, password = password,
tieBreaker = tieBreaker, tieBreaker = tieBreaker,
writeBuffer = writeBuffer, writeBuffer = writeBuffer,
useSsl = useSsl, ssl = ssl,
sslHost = sslHost, sslHost = sslHost,
configChannel = configChannel, configChannel = configChannel,
abortOnConnectFail = abortOnConnectFail, abortOnConnectFail = abortOnConnectFail,
...@@ -236,7 +243,7 @@ public ConfigurationOptions Clone() ...@@ -236,7 +243,7 @@ public ConfigurationOptions Clone()
/// </summary> /// </summary>
public void SetDefaultPorts() public void SetDefaultPorts()
{ {
endpoints.SetDefaultPorts(UseSsl ? 6380 : 6379); endpoints.SetDefaultPorts(Ssl ? 6380 : 6379);
} }
/// <summary> /// <summary>
...@@ -259,7 +266,7 @@ public override string ToString() ...@@ -259,7 +266,7 @@ public override string ToString()
Append(sb, PasswordPrefix, password); Append(sb, PasswordPrefix, password);
Append(sb, TieBreakerPrefix, tieBreaker); Append(sb, TieBreakerPrefix, tieBreaker);
Append(sb, WriteBufferPrefix, writeBuffer); Append(sb, WriteBufferPrefix, writeBuffer);
Append(sb, UseSslPrefix, useSsl); Append(sb, sslPrefix, ssl);
Append(sb, SslHostPrefix, sslHost); Append(sb, SslHostPrefix, sslHost);
Append(sb, ConfigChannelPrefix, configChannel); Append(sb, ConfigChannelPrefix, configChannel);
Append(sb, AbortOnConnectFailPrefix, abortOnConnectFail); Append(sb, AbortOnConnectFailPrefix, abortOnConnectFail);
...@@ -352,7 +359,7 @@ void Clear() ...@@ -352,7 +359,7 @@ void Clear()
{ {
clientName = serviceName = password = tieBreaker = sslHost = configChannel = null; clientName = serviceName = password = tieBreaker = sslHost = configChannel = null;
keepAlive = syncTimeout = connectTimeout = writeBuffer = null; keepAlive = syncTimeout = connectTimeout = writeBuffer = null;
allowAdmin = abortOnConnectFail = resolveDns = useSsl = null; allowAdmin = abortOnConnectFail = resolveDns = ssl = null;
defaultVersion = null; defaultVersion = null;
endpoints.Clear(); endpoints.Clear();
commandMap = null; commandMap = null;
...@@ -443,10 +450,10 @@ private void DoParse(string configuration) ...@@ -443,10 +450,10 @@ private void DoParse(string configuration)
{ {
TieBreaker = value.Trim(); TieBreaker = value.Trim();
} }
else if (IsOption(option, UseSslPrefix)) else if (IsOption(option, sslPrefix))
{ {
bool tmp; bool tmp;
if (Format.TryParseBoolean(value.Trim(), out tmp)) UseSsl = tmp; if (Format.TryParseBoolean(value.Trim(), out tmp)) Ssl = tmp;
} }
else if (IsOption(option, SslHostPrefix)) else if (IsOption(option, SslHostPrefix))
{ {
......
...@@ -526,7 +526,7 @@ SocketMode ISocketCallback.Connected(Stream stream) ...@@ -526,7 +526,7 @@ SocketMode ISocketCallback.Connected(Stream stream)
// [network]<==[ssl]<==[logging]<==[buffered] // [network]<==[ssl]<==[logging]<==[buffered]
var config = multiplexer.RawConfig; var config = multiplexer.RawConfig;
if(config.UseSsl) if(config.Ssl)
{ {
var host = config.SslHost; var host = config.SslHost;
if (string.IsNullOrWhiteSpace(host)) host = Format.ToStringHostOnly(bridge.ServerEndPoint.EndPoint); if (string.IsNullOrWhiteSpace(host)) host = Format.ToStringHostOnly(bridge.ServerEndPoint.EndPoint);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment