-
Notifications
You must be signed in to change notification settings - Fork 160
Description
Describe the bug
Having a question mark "?" as part of the password in the connection string breaks parsing of the connection string.
As the RabbitMQ URI Specification has no mention of this, I am assuming that this is an actual bug, either in the aforementioned documentation or the library - unless I am doing something wrong which is not entirely unlikely. In comparison, pika does not seem to take any offence of this but maybe pika is doing some shenanigans behind our backs.
I can work around it doing url encoding of the password and string concatenation but I find it a bit clunky. Having looked at the documentation and examples, I did not find another way of approaching this which might circumvent to issue.
Now, should the library handle this? Tbh, I do not know but it sure would be nice if there was a way of passing a set of plains credentials to a dail-like function which would deal with url encoding for us.
To Reproduce
Steps to reproduce the behavior:
- use ampq091-go v1.10.0 and go version go1.24.3 linux/amd64
- add code
conn, err := amqp091.Dial("amqp://cert_refresh:password?@192.168.0.9:5672/") failOnError(err, "unable to connect to RabbitMQ") defer conn.Close()
- go run main.go
- observer error
2025/06/23 18:14:57 unable to connect to RabbitMQ: parse "amqp://username:password?@192.168.0.9:5672/": invalid port ":password" after host exit status 1
- remove "?" from connection string
- go run main.go
- observer more reasonable error
2025/06/23 18:17:37 unable to connect to RabbitMQ: Exception (403) Reason: "username or password not allowed" exit status 1
Desktop (please complete the following information):
- OS: Linnux - running code on default devcontainer
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
- devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/go { "name": "Go", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/go:1-1.24-bookworm", "customizations": { "vscode": { "extensions": [ "golang.go", "streetsidesoftware.code-spell-checker-danish", "streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker-british-english", "k--kato.intellij-idea-keybindings", "-dbaeumer.vscode-eslint", "-visualstudioexptteam.intellicode-api-usage-examples", "-visualstudioexptteam.vscodeintellicode", "-ms-vscode.js-debug-companion" ] } } // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "go version", // Configure tool-specific properties. // "customizations": {}, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" }
Additional context
$ docker inspect $(docker images | grep -E "devcontainers/go.*1-1.24-bookworm" | awk '{print $3}')
[
{
"Id": "sha256:451f25fbfc6d97eec6cbab92cfcf064cbedd518c663a318c090a5e613d870e2b",
"RepoTags": [
"mcr.microsoft.com/devcontainers/go:1-1.24-bookworm"
],
"RepoDigests": [
"mcr.microsoft.com/devcontainers/go@sha256:f7a740615ff205f7df9d531fb6aa864a38887956ddbd9a20be33df8a2924fa09"
],
"Parent": "",
"Comment": "buildkit.dockerfile.v0",
"Created": "2025-05-30T10:59:38.495535247Z",
"DockerVersion": "",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "root",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/share/nvm/current/bin:/usr/local/go/bin:/go/bin:/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOLANG_VERSION=1.24.3",
"GOTOOLCHAIN=local",
"GOPATH=/go",
"GOROOT=/usr/local/go",
"NVM_DIR=/usr/local/share/nvm",
"NVM_SYMLINK_CURRENT=true"
],
"Cmd": [
"bash"
],
"Image": "",
"Volumes": null,
"WorkingDir": "/go",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"dev.containers.id": "go",
"dev.containers.release": "v0.4.16",
"dev.containers.source": "https://github.com/devcontainers/images",
"dev.containers.timestamp": "Fri, 30 May 2025 10:55:11 GMT",
"dev.containers.variant": "1.24-bookworm",
"devcontainer.metadata": "[ {\"id\":\"ghcr.io/devcontainers/features/common-utils:2\"}, {\"id\":\"ghcr.io/devcontainers/features/git:1\",\"customizations\":{\"vscode\":{\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes an up-to-date version of Git, built from source as needed, pre-installed and available on the `PATH`.\"}]}}}}, {\"id\":\"ghcr.io/devcontainers/features/go:1\",\"init\":true,\"capAdd\":[\"SYS_PTRACE\"],\"securityOpt\":[\"seccomp=unconfined\"],\"customizations\":{\"vscode\":{\"extensions\":[\"golang.Go\"],\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes Go and common Go utilities pre-installed and available on the `PATH`, along with the Go language extension for Go development.\"}]}}}}, {\"id\":\"ghcr.io/devcontainers/features/node:1\",\"customizations\":{\"vscode\":{\"extensions\":[\"dbaeumer.vscode-eslint\"],\"settings\":{\"github.copilot.chat.codeGeneration.instructions\":[{\"text\":\"This dev container includes `node`, `npm` and `eslint` pre-installed and available on the `PATH` for Node.js and JavaScript development.\"}]}}}}, {\"customizations\":{\"vscode\":{\"settings\":{\"go.toolsManagement.checkForUpdates\":\"local\",\"go.useLanguageServer\":true,\"go.gopath\":\"/go\"},\"extensions\":[\"golang.Go\"]}},\"remoteUser\":\"vscode\"} ]",
"version": "1.4.3"
}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 1601022906,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/5d72b22c38e3edc0fb72aa083c2e4989fce369a0c1840da4fbb74bdfe8a6c9d8/diff:/var/lib/docker/overlay2/7630b35ce70ae5486ba1af1b92f3adbd28e805b407e43496e2b69e31c8acda6c/diff:/var/lib/docker/overlay2/9180969358e9dbe04d4484cc183ce677eaca79ca78f003de4e56779f61a6ad3f/diff:/var/lib/docker/overlay2/a436066eb1c94d666d66304e1d536ba8de3b902a2e02fed42a9da58cc1ae22ef/diff:/var/lib/docker/overlay2/882fb90a4ac5b2f8d31d7ebfcd6e184b7f004de669d0ad2399eddad030fc1fe0/diff:/var/lib/docker/overlay2/40a90674959665e4fbec6314f27f3a680773d0e47a245a7952ac10be6ea8b181/diff:/var/lib/docker/overlay2/7e78e7a97f9ee691a9bfd44ab1d3b0c905ca54530821c34058d50ed9b3507dea/diff:/var/lib/docker/overlay2/ce1c51e868481850f893e438c470ac717afb2e64fba3417a0809c53fd5d6eba8/diff:/var/lib/docker/overlay2/77197a2e1bb0bca9f539870df947f7b2862bba05f0c3d30126c8d824cae97bfe/diff:/var/lib/docker/overlay2/bffb8bd67c922b1dbcaa8cb59885ee01e0b3766df156eaedee66e966439d683c/diff:/var/lib/docker/overlay2/ce949029f1f0820925ab4e4dc0ddfcbc33ecde3d70d6218b1f367eecbf5b44fc/diff:/var/lib/docker/overlay2/3bb9baeb849d03e7c766cc418172343fd3c77d8d7ebc360a41248ccd321afa63/diff:/var/lib/docker/overlay2/c5eceb70100ae7b2568737e15aae47c6e01441e1bdec20dd77e6e0bfb43e4235/diff:/var/lib/docker/overlay2/a37b470105bdcfa83b218c095391b7fef0e9f6c014153bcb4cd46603b14adfde/diff",
"MergedDir": "/var/lib/docker/overlay2/c96b989870ce596453d3240c81e47d26fe56ad5171ac108ab25cd6c9bcd82800/merged",
"UpperDir": "/var/lib/docker/overlay2/c96b989870ce596453d3240c81e47d26fe56ad5171ac108ab25cd6c9bcd82800/diff",
"WorkDir": "/var/lib/docker/overlay2/c96b989870ce596453d3240c81e47d26fe56ad5171ac108ab25cd6c9bcd82800/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2f7436e79a0bc6cdec6536da54ae6a5863c8e3b5f145e0f8ac0b96306baddbc9",
"sha256:6428cc293366f93395949a2d1efd9b89c898c7a4a124051c3793c1faf7664269",
"sha256:e4dc8cd9ecc886f56babec383662506d94a28645c1a31085deaf7870366ec225",
"sha256:c36fa70bdbbed0c44423c742ac1f5d5e21b1df40562d9e8d780a601236d21c3a",
"sha256:469deeced89d3ef303495727a33a854a535ae3fa2c562eccae864e4a5731c6ad",
"sha256:7cd15fc55de58d3ea6bd5a033cb8048e34f5fddd68738374532cc8f743e1d15a",
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
"sha256:af2e4ada3301bb99e3430baf35fab36f787b9b61e4cc1ed3ab2cbeca0bce4fcf",
"sha256:151fa49aea8a6376fb04ba9d1c4aab43908bb987bd8e3c5686951656960323f8",
"sha256:1e9adb5d3b184b3e3fec90df29e16d495478571d031518ca67a5b881679de7fe",
"sha256:a754c025aa06718e16e44d040566b95ff1f0da21eeafde0da12d34f49eecc18d",
"sha256:a093df73a63b59f0d8c7b5e235ac6dde12f0be2f6cc90057b7cecc1c500802fb",
"sha256:2beeeb604834fc3e10040f551c3aaa7b22cf74638bf913d8bea7a5c06e5ffb48",
"sha256:229f8aafbac3ef5336743c14ffe9fe5ff1d15a2a0a62a25ca3efa311207afdf0",
"sha256:81d920c2a363e4369a0d3c0f6e8d93bf8ff6f29200e9489c25c8d61cfaffc9f0"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]