Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
12d65d0a
Commit
12d65d0a
authored
Jul 13, 2015
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #218 from hrishi18pathak/master
Default SslHost in clustering mode
parents
248d936d
1b01dc86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
SSL.cs
StackExchange.Redis.Tests/SSL.cs
+19
-0
ConfigurationOptions.cs
...xchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
+11
-1
No files found.
StackExchange.Redis.Tests/SSL.cs
View file @
12d65d0a
...
@@ -271,5 +271,24 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv)
...
@@ -271,5 +271,24 @@ public void RedisLabsEnvironmentVariableClientCertificate(bool setEnv)
}
}
[
Test
]
public
void
SSLHostInferredFromEndpoints
()
{
var
options
=
new
ConfigurationOptions
()
{
EndPoints
=
{
{
"mycache.rediscache.windows.net"
,
15000
},
{
"mycache.rediscache.windows.net"
,
15001
},
{
"mycache.rediscache.windows.net"
,
15002
},
}
};
options
.
Ssl
=
true
;
Assert
.
True
(
options
.
SslHost
==
"mycache.rediscache.windows.net"
);
options
=
new
ConfigurationOptions
()
{
EndPoints
=
{
{
"121.23.23.45"
,
15000
},
}
};
Assert
.
True
(
options
.
SslHost
==
null
);
}
}
}
}
}
StackExchange.Redis/StackExchange/Redis/ConfigurationOptions.cs
View file @
12d65d0a
...
@@ -243,7 +243,7 @@ public CommandMap CommandMap
...
@@ -243,7 +243,7 @@ public CommandMap CommandMap
/// <summary>
/// <summary>
/// The target-host to use when validating SSL certificate; setting a value here enables SSL mode
/// The target-host to use when validating SSL certificate; setting a value here enables SSL mode
/// </summary>
/// </summary>
public
string
SslHost
{
get
{
return
sslHost
;
}
set
{
sslHost
=
value
;
}
}
public
string
SslHost
{
get
{
return
sslHost
??
InferSslHostFromEndpoints
()
;
}
set
{
sslHost
=
value
;
}
}
/// <summary>
/// <summary>
/// Specifies the time in milliseconds that the system should allow for synchronous operations (defaults to 1 second)
/// Specifies the time in milliseconds that the system should allow for synchronous operations (defaults to 1 second)
...
@@ -608,5 +608,15 @@ private void DoParse(string configuration, bool ignoreUnknown)
...
@@ -608,5 +608,15 @@ private void DoParse(string configuration, bool ignoreUnknown)
this
.
CommandMap
=
CommandMap
.
Create
(
map
);
this
.
CommandMap
=
CommandMap
.
Create
(
map
);
}
}
}
}
private
string
InferSslHostFromEndpoints
()
{
var
dnsEndpoints
=
endpoints
.
Select
(
endpoint
=>
endpoint
as
DnsEndPoint
);
string
dnsHost
=
dnsEndpoints
.
First
()
!=
null
?
dnsEndpoints
.
First
().
Host
:
null
;
if
(
dnsEndpoints
.
All
(
dnsEndpoint
=>
(
dnsEndpoint
!=
null
&&
dnsEndpoint
.
Host
==
dnsHost
)))
{
return
dnsHost
;
}
return
null
;
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment