stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

Stomp+SSL Use-Case 1 wiki disagrees with example code #138

Closed steveforse closed 7 years ago

steveforse commented 7 years ago

SSL use-case 1 suggests the following line of code:

ssl_params = nil

While /examples/ssl_uc1.rb uses:

ssl_opts = Stomp::SSLParams.new

I don't know if it's just me, but using ActiveMQ/Stomp with the first example caused the client connection to hang. However, the second one worked fine for me.

gmallard commented 7 years ago

I can not get that example to hang if I use nil.

I can get it to raise an exception - which it should not do. And I'll work on that.

Using nil or an 'empty' SSLParams should behave the same way.

gmallard commented 7 years ago

I misspoke above.

If you use ssl_opts = true, the gem will behave as if you had used Stomp::SSLParams.new.

It you use ssl_opts = nil or ssl_opts = false, the gem expects that you are not doing SSL, and in this case the port number should reflect that.

AMQ seems to try and proceed with the SSL handshake, even when it receives just plaintext from the wire (some other brokers do not continue, they break the connection). I am going to try and detect that AMQ behavior, raise an exception if detected. Just to make gem behavior a little more explicit.

In any case, you should not mismatch SSP Parameters and port number.

I will update the wiki to reflect that, and am closing this issue.

Lastly, some advice: if you are going to "do SSL", then do it right. That means use case 4.