-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Key names cannot include // or start with / and this is not documented #3476
Comments
So for anyone with the same problem, I have a workaround: use the golang library function net/url.PathEscape(s) to translate your key name s to a key name that will work with consul. You will also need to use net/url.PathUnescape(k) to convert a key name from consul into your own key name space. This is not a good situation. It's hard to document the current syntax of key names in consul. A technical detail of consul's implementation is bleeding through here. Namely, consul uses key names in URL paths, and moreover uses golang net/http to process these. The net/http library appears to put more restrictions on URL paths than does RFC 3986. So I guess that the documentation is that you can use any string s such that s == url.PathEscape(s) ?? |
I was able to reproduce this as well. Here's a simple test case:
In addition to this I noticed that the GET method returns the same value, double '/' or not.
Is this expected behavior? Seems like it might be better if it was at least consistent across various methods. |
Part of this is Go's behavior as seen in hashicorp/nomad#3620, but we need to make the key format clear. Also, the https://www.consul.io/api/txn.html API takes key names outside of URLs so might make keys that can't be accessed by the URL-based API. |
Hey there, Feel free to check out the community forum as well! |
Hey there, This issue has been automatically closed because there hasn't been any activity for at least 90 days. If you are still experiencing problems, or still have questions, feel free to open a new one 👍 |
Hey there, This issue has been automatically locked because it is closed and there hasn't been any activity for at least 30 days. If you are still experiencing problems, or still have questions, feel free to open a new one 👍. |
consul version
for both Client and ServerClient:
Consul v0.9.2
Server:
Consul v0.9.2
Description of the Issue (and unexpected/desired result)
I wanted to use a key name that is a base64 encoded value. These can start with slash (/) and can contain double slash (//).
Turns out this fails. I don't see any discussion of the accepted syntax of key names in the documentation. Moreover the error message is cryptic.
I understand looking through other issues that this may be related to use of net/http.
Can this at least be documented?
Reproduction steps
The text was updated successfully, but these errors were encountered: