-
Notifications
You must be signed in to change notification settings - Fork 584
Handle basic query parameters in connection URI #672
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
Handle basic query parameters in connection URI #672
Conversation
try { | ||
for (String param : rawQuery.split("&")) { | ||
String[] pair = param.split("="); | ||
String key = URLDecoder.decode(pair[0], "US-ASCII"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to not use UTF-8
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the same charset as in uriDecode line 378, which is used to decode username password and vhost.
private static String uriDecode(String s) {
try {
// URLDecode decodes '+' to a space, as for
// form encoding. So protect plus signs.
return URLDecoder.decode(s.replace("+", "%2B"), "US-ASCII");
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
@acogoluegnes FYI, I discussed this with @captainju on Slack and suggested that we would consider such a contribution. |
Thanks! |
With fallback hook, by default empty. References #672
Proposed Changes
The current connection method
setUri()
does not handle query parameters at all, unlike the official Erlang client.This pull request adds basic query parameters capabilities.
However, due to SSL handling differences between the Erlang client and the Java client, all SSL parameters are not used.
Only the following parameters are used:
(taken from https://www.rabbitmq.com/uri-query-parameters.html)
It is easily extendable for other future query parameters.
Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.
CONTRIBUTING.md
document