Skip to content

Commit 40900ae

Browse files
committed
fix: handle unbracketed IPv6 in ParseHostEndpoint
1 parent 767e2d0 commit 40900ae

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Foundatio.RabbitMQ/Messaging/RabbitMQMessageBus.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,10 @@ private static string SanitizeUri(Uri uri)
862862
if (colonIndex < 0)
863863
return new AmqpTcpEndpoint(trimmed, defaultPort);
864864

865+
// Multiple colons without brackets indicates an unbracketed IPv6 address — treat as bare hostname
866+
if (trimmed.IndexOf(':') != colonIndex)
867+
return new AmqpTcpEndpoint(trimmed, defaultPort);
868+
865869
string hostname = trimmed[..colonIndex];
866870
return Int32.TryParse(trimmed[(colonIndex + 1)..], out int parsedPort)
867871
? new AmqpTcpEndpoint(hostname, parsedPort)

0 commit comments

Comments
 (0)