Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AmqpTcpEndpoint.ToString() does not report a Uri scheme of "amqps" although SslOption is enabled #861

Closed
ghost opened this issue Jun 9, 2020 · 2 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Jun 9, 2020

AmqpTcpEndpoint.ToString() should correctly report a Uri scheme of amqps whenever its SSLOption is enabled.

From AmqpTcpEndpoint.cs, line 282 ff.:

        /// <summary>
        /// Returns a URI-like string of the form amqp-PROTOCOL://HOSTNAME:PORTNUMBER.
        /// </summary>
        /// <remarks>
        /// This method is intended mainly for debugging and logging use.
        /// </remarks>
        public override string ToString()
        {
            return $"amqp://{HostName}:{Port}";
        }

Compare this to the implementation of ConnectionFactory.SetUri(...) ConnectionFactory.cs, line 531 ff. where an Uri scheme of amqps is correctly interpreted to initialize the SSLOption:

        private void SetUri(Uri uri)
        {
            Endpoint = new AmqpTcpEndpoint();

            if (string.Equals("amqp", uri.Scheme, StringComparison.OrdinalIgnoreCase))
            {
                // nothing special to do
            }
            else if (string.Equals("amqps", uri.Scheme, StringComparison.OrdinalIgnoreCase))
            {
                Ssl.Enabled = true;
                Ssl.Version = AmqpUriSslProtocols;
                Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch;
                Port = AmqpTcpEndpoint.DefaultAmqpSslPort;
            }
            else
            {
                throw new ArgumentException($"Wrong scheme in AMQP URI: {uri.Scheme}");
            }
@michaelklishin
Copy link
Member

This is open source software. If you understand what exactly should be changed and why, please submit a pull request and it will be considered.

@lukebakken
Copy link
Contributor

Fixed by #864

@lukebakken lukebakken modified the milestones: 6.1.1, 6.2.0 Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants