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

Parse URI Query Parameters #67

Merged
merged 1 commit into from Dec 6, 2017

Conversation

Tensho
Copy link
Contributor

@Tensho Tensho commented Dec 6, 2017

PR for #66

So here is the AMQ::URI.parse method extension for query parameters. This is a prototype code that I'd like to polish after main ideas agreement:
• Introduce DEFAULTS constant to keep them as some kind of declaration
• Raise ArgumentError for ssl/tls parameters along with amqp schema
• Some concerns about URI and CGI usage. I'm not so keen on this libraries to understand what should help us escape and parse properly. Could somebody give insight regarding this?

@michaelklishin, do you like such nested structure of the contexts in the specs? I noticed you don't compose contexts and prefer to interpolate "when ... inside example description. If you find such approach more flexible and expressive, I'd happy to adjust existing specs in uri_parsing_spec.rb file to the same look.


%w(verify fail_if_no_peer_cert cacertfile certfile keyfile).each do |ssl_option|
if normalized_query_params[ssl_option] && uri.scheme == "amqp"
raise ArgumentError.new("Only of use for the amqps scheme")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message doesn't clarify what is "of use" (can be used). Please add it.

Copy link
Contributor Author

@Tensho Tensho Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, what does sound the best?

  1. 'verify' TLS option is applicable only for 'amqps' schema
  2. 'verify' option should be used only within 'amqps' schema
  3. TLS options are relevant only for 'amqps' schema

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The option 'verify' can only be used in URIs that use amqps for schema". Arguably it should be a warning since non-TLS connections would simply ignore it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind to convert it to the warning, but an exception could attract attention to the possible misspelling of the schema. Maybe you already have a convention in this or other ruby-amqp libraries, so it will be natural to keep consistent behavior across all of them.

Copy link
Contributor Author

@Tensho Tensho Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG, it was so fast. I feel like talk too much ^_^
Leave the exception or change to the warning?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did change the message in 50dbf6b but because I cannot push that to your repo, it won't show up here.

Copy link
Contributor Author

@Tensho Tensho Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed when fetched upstream ^_^ That's OK. BTW, is it preferable to contribute from forked repo or straight to the initial repo? There is no CONTRIBUTION guide in amq-protocol ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have the permissions to push to the mainline. I see no reason to not pull from and branch off of it. I don't really care as long as the PR is against the correct branch and is something I'd accept.

@michaelklishin michaelklishin merged commit 1a3f860 into ruby-amqp:master Dec 6, 2017
@Tensho Tensho deleted the uri-query-parameters branch December 6, 2017 19:13
@Tensho Tensho mentioned this pull request Dec 6, 2017
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 14, 2018
## Changes between 2.2.0 and 2.3.0 (Jan 8th, 2018)

### Support for Additional URI Query Parameters

GitHub issue: [#67](ruby-amqp/amq-protocol#67), [#68](ruby-amqp/amq-protocol#68), [#69](ruby-amqp/amq-protocol#69).

Contributed by Andrew Babichev.
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

Successfully merging this pull request may close these issues.

None yet

2 participants