Skip to content

Commit 8bb9070

Browse files
author
Alexandru Scvortov
committed
.net on windows says valid URIs must contain the host part
1 parent d08b577 commit 8bb9070

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace RabbitMQ.Client
8181
///</para>
8282
///<example><code>
8383
/// ConnectionFactory factory = new ConnectionFactory();
84-
/// factory.Uri = "amqp://";
84+
/// factory.Uri = "amqp://localhost";
8585
/// IConnection conn = factory.CreateConnection();
8686
/// ...
8787
///</code></example>
@@ -91,9 +91,10 @@ namespace RabbitMQ.Client
9191
///<para>
9292
///Note that the Uri property takes a string representation of an
9393
///AMQP URI. Omitted URI parts will take default values. The
94-
///only deviation from the spec is that URIs of the form
95-
///"amqp://foo/" (note the trailling slash) are used to represent
96-
///the default virtual host.</para></remarks>
94+
///only deviations from the spec are that URIs of the form
95+
///"amqp://foo/" (note the trailling slash) also represent the
96+
///default virtual host and that the hostname must be specified.
97+
///</para></remarks>
9798
public class ConnectionFactory
9899
{
99100
/// <summary>Default user name (value: "guest")</summary>

projects/client/Unit/src/unit/TestAmqpUri.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ public void TestAmqpUriParse()
5555
"user", "pass", "host", 10000, "vhost");
5656
ParseSuccess("amqp://user%61:%61pass@host:10000/v%2fhost",
5757
"usera", "apass", "host", 10000, "v/host");
58-
ParseSuccess("amqp://", "guest", "guest", "localhost", 5672, "/");
59-
ParseSuccess("amqp://:@/", "", "", "localhost", 5672, "/");
60-
ParseSuccess("amqp://user@",
58+
ParseSuccess("amqp://localhost", "guest", "guest", "localhost", 5672, "/");
59+
ParseSuccess("amqp://:@localhost/", "", "", "localhost", 5672, "/");
60+
ParseSuccess("amqp://user@localhost",
6161
"user", "guest", "localhost", 5672, "/");
62-
ParseSuccess("amqp://user:pass@",
62+
ParseSuccess("amqp://user:pass@localhost",
6363
"user", "pass", "localhost", 5672, "/");
6464
ParseSuccess("amqp://host", "guest", "guest", "host", 5672, "/");
65-
ParseSuccess("amqp://:10000",
65+
ParseSuccess("amqp://localhost:10000",
6666
"guest", "guest", "localhost", 10000, "/");
67-
ParseSuccess("amqp:///vhost",
67+
ParseSuccess("amqp://localhost/vhost",
6868
"guest", "guest", "localhost", 5672, "vhost");
6969
ParseSuccess("amqp://host/", "guest", "guest", "host", 5672, "/");
7070
ParseSuccess("amqp://host/%2f",
@@ -85,7 +85,7 @@ public void TestAmqpUriParse()
8585
"guest", "guest", "host", 5672, "blah");
8686
ParseSuccess("amqp://host:100/blah",
8787
"guest", "guest", "host", 100, "blah");
88-
ParseSuccess("amqp://:100/blah",
88+
ParseSuccess("amqp://localhost:100/blah",
8989
"guest", "guest", "localhost", 100, "blah");
9090
ParseSuccess("amqp://[::1]/blah",
9191
"guest", "guest",
@@ -100,7 +100,7 @@ public void TestAmqpUriParse()
100100
"user", "pass", "host", 5672, "/");
101101
ParseSuccess("amqp://user:pass@host:100",
102102
"user", "pass", "host", 100, "/");
103-
ParseSuccess("amqp://user:pass@:100",
103+
ParseSuccess("amqp://user:pass@localhost:100",
104104
"user", "pass", "localhost", 100, "/");
105105
ParseSuccess("amqp://user:pass@[::1]",
106106
"user", "pass",

0 commit comments

Comments
 (0)