Skip to content

Commit bf2a799

Browse files
committed
Moved DefaultAmqpSslProtocols from AmqpTcpEndpoint to ConnectionFactory as DefaultAmqpUriSslProtocols
Added per-instance AmqpUriSslProtocols to ConnectionFactory.
1 parent 011d097 commit bf2a799

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

projects/client/RabbitMQ.Client/src/client/api/AmqpTcpEndpoint.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
using System;
4242
using System.Collections.Generic;
43-
using System.Security.Authentication;
4443
using System.Text.RegularExpressions;
4544

4645
namespace RabbitMQ.Client
@@ -63,7 +62,6 @@ public class AmqpTcpEndpoint// : ICloneable
6362
/// </summary>
6463
public const int DefaultAmqpSslPort = 5671;
6564

66-
6765
/// <summary>
6866
/// Indicates that the default port for the protocol should be used.
6967
/// </summary>
@@ -140,11 +138,6 @@ public AmqpTcpEndpoint CloneWithHostname(string hostname)
140138
return new AmqpTcpEndpoint(hostname, _port, Ssl);
141139
}
142140

143-
/// <summary>
144-
/// The default Amqp SSL protocols.
145-
/// </summary>
146-
public static SslProtocols DefaultAmqpSslProtocols { get; set; } = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
147-
148141
/// <summary>
149142
/// Retrieve or set the hostname of this <see cref="AmqpTcpEndpoint"/>.
150143
/// </summary>
@@ -181,7 +174,7 @@ public IProtocol Protocol
181174
/// <summary>
182175
/// Used to force the address family of the endpoint
183176
/// </summary>
184-
public System.Net.Sockets.AddressFamily AddressFamily { get; set; }
177+
public System.Net.Sockets.AddressFamily AddressFamily {get; set;}
185178

186179
/// <summary>
187180
/// Retrieve the SSL options for this AmqpTcpEndpoint. If not set, null is returned.
@@ -235,7 +228,7 @@ public static AmqpTcpEndpoint Parse(string address)
235228
/// </remarks>
236229
public static AmqpTcpEndpoint[] ParseMultiple(string addresses)
237230
{
238-
string[] partsArr = addresses.Split(new[] { ',' });
231+
string[] partsArr = addresses.Split(new[] {','});
239232
var results = new List<AmqpTcpEndpoint>();
240233
foreach (string partRaw in partsArr)
241234
{

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
using System.Collections.Generic;
4646
using System.Threading.Tasks;
4747
using System.Linq;
48+
using System.Security.Authentication;
4849

4950
#if !NETFX_CORE
5051

@@ -141,6 +142,18 @@ public class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
141142
/// <remarks> PLEASE KEEP THIS MATCHING THE DOC ABOVE.</remarks>
142143
public const string DefaultVHost = "/";
143144

145+
/// <summary>
146+
/// The default AMQP URI SSL protocols.
147+
/// </summary>
148+
public static SslProtocols DefaultAmqpUriSslProtocols { get; set; } =
149+
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
150+
151+
/// <summary>
152+
/// The AMQP URI SSL protocols.
153+
/// </summary>
154+
public SslProtocols AmqpUriSslProtocols { get; set; } =
155+
DefaultAmqpUriSslProtocols;
156+
144157
/// <summary>
145158
/// Default SASL auth mechanisms to use.
146159
/// </summary>
@@ -517,7 +530,7 @@ private void SetUri(Uri uri)
517530
else if (string.Equals("amqps", uri.Scheme, StringComparison.OrdinalIgnoreCase))
518531
{
519532
Ssl.Enabled = true;
520-
Ssl.Version = AmqpTcpEndpoint.DefaultAmqpSslProtocols;
533+
Ssl.Version = AmqpUriSslProtocols;
521534
#if !(NETFX_CORE)
522535
Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch;
523536
#endif

0 commit comments

Comments
 (0)