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

failed to dail() when password contains with special characters like "#" #522

Open
devloper999 opened this issue Feb 2, 2022 · 0 comments

Comments

@devloper999
Copy link

Similar to issue mentioned in the thread : #416
Hi, I am facing the same issue in the above thread with amqp.Dial, if the username or password has "#" symbol, then the split happen at # internally in the Dial code. Can someone please help how to resolve this. I tried even query escape but no luck.
Code inside amqp Dial method : url.Parse splits at # and it is causing the invalidPort error.
func Parse(rawURL string) (*URL, error) {
// Cut off #frag
u, frag := split(rawURL, '#', true)

Below is the code snippet
func connectToRMQServer() {
fmt.Println("Connection staretd ")
rmqurl := "amqp://guest:" + url.QueryEscape("guest#") + "@localhost:5672/"
fmt.Println("rmqurl ", rmqurl)
conn, err := amqp.Dial(rmqurl)
if err != nil {
fmt.Println("Error is ", "Failed to connect to RabbitMQ", err)
return
}
fmt.Println("Connection succesful ", conn)
}
func main() {
fmt.Println("in main")
connectToRMQServer()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant