rabbitmq / rabbitmq-objc-client

RabbitMQ client for Objective-C and Swift
https://rabbitmq.com
Other
241 stars 84 forks source link

vhost with multiple slashes #146

Closed GaoShin closed 5 years ago

GaoShin commented 5 years ago

I have tried vhost with one slash and no slash and both work fine.But if the vhost contains more than 2 slashes it will never work.Here is an example: amqp://test:test@192.168.1.3/%2fpath1%2fpath2

And then I find out that the problem is the method in RMQURI.m:

michaelklishin commented 5 years ago

What does "never work" mean specifically? The URI parsing fails? Something else?

GaoShin commented 5 years ago

This method will return nil: (nullable instancetype)parse:(nonnull NSString )uri error:(NSError _Nullable * _Nullable)error; And I can see the error log from Xcode:

TestRabbitMQ[884:167898] Received connection: <RMQConnection: 0x283be4780> failedToConnectWithError: Error Domain=GCDAsyncSocketErrorDomain Code=2 "Invalid host parameter (nil or ""). Should be a domain name or IP address string." UserInfo={NSLocalizedDescription=Invalid host parameter (nil or ""). Should be a domain name or IP address string.}

michaelklishin commented 5 years ago

Thanks, that's enough information to investigate.

michaelklishin commented 5 years ago

@GaoShin master should be good to go. The limitation was intentional but artificial. No other clients impose it, so I removed it and added more tests. Thank you for reporting this!