iande / onstomp

A STOMP messaging client library for Ruby
http://mathish.com/projects/onstomp.html
Other
23 stars 11 forks source link

Add 'ssl_version' to DEFAULT_SSL_OPTIONS #23

Closed todomodo closed 10 years ago

todomodo commented 10 years ago

As a ruby developer I should be able to specify :ssl_version when calling OnStomp.connect And have it taking effect when creating SSL context

Example: {code} require 'onstomp' OnStomp.connect('stomp+ssl://user:pass@myhost.com:61614', {:ssl=>{:ssl_version=>'SSLv3'}}) {code}

Above call will currently have no effect since :ssl_version is not part of DEFAULT_SSL_OPTIONS and will be ignored when setting SSL Context inside "def self.create_socket_ssl client":

{code} DEFAULT_SSL_OPTIONS.keys.each do |k| context.send(:"#{k}=", ssl_opts[k]) if ssl_opts.key?(k) end {code}

In other words custom settings are only applied if they correspond to a default value. Since there's no default for :ssl_version, it will get ignored

iande commented 10 years ago

Should be pretty straight forward to include that option. I may just change my approach to the SSL context options all together, as there are many other options that a developer may wish to specify.

iande commented 10 years ago

You should now be able to specify ssl_version and any other options that OpenSSL::SSL::SSLContext responds to.

todomodo commented 10 years ago

Well done, thanks!