Skip to content

Commit 4aadebb

Browse files
author
Alexandru Scvortov
committed
don't allow escapes in the hostname
Actually, an escape in the hostname was throwing off the parser. I've documented the issue and left it like this. The alternative would be to write an URI parser that supports escapes in hosts, which is probably not worth the effort.
1 parent 3d1cdcd commit 4aadebb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void setVirtualHost(String virtualHost) {
187187
* Convenience method for setting the fields in an AMQP URI: host,
188188
* port, username, password and virtual host. If any part of the
189189
* URI is ommited, the ConnectionFactory's corresponding variable
190-
* is left unchanged.
190+
* is left unchanged. Escapes in the hostname are not permitted.
191191
* @param uriString is the AMQP URI containing the data
192192
*/
193193
public void setUri(String uriString)

test/src/com/rabbitmq/client/test/AmqpUriTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public void testUriParsing() throws URISyntaxException {
2626
/* From the spec */
2727
parseSuccess("amqp://user:pass@host:10000/vhost",
2828
"user", "pass", "host", 10000, "vhost");
29-
parseSuccess("amqp://user%61:%61pass@ho%61st:10000/v%2fhost",
30-
"usera", "apass", "hoast", 10000, "v/host");
29+
parseSuccess("amqp://user%61:%61pass@host:10000/v%2fhost",
30+
"usera", "apass", "host", 10000, "v/host");
3131
parseSuccess("amqp://", "guest", "guest", "localhost", 5672, "/");
3232
parseSuccess("amqp://:@/", "", "", "localhost", 5672, "");
3333
parseSuccess("amqp://user@", "user", "guest", "localhost", 5672, "/");

0 commit comments

Comments
 (0)