njh / ruby-mqtt

Pure Ruby gem that implements the MQTT protocol, a lightweight protocol for publish/subscribe messaging.
http://www.rubydoc.info/gems/mqtt
MIT License
538 stars 135 forks source link

SSL connection failing due to optimisations in PR #134 #135

Closed Andy-Bell closed 2 years ago

Andy-Bell commented 3 years ago

Hitting an issue with this library due to #134, I now cannot get the client to load an SSL connection.

Ruby version 2.7.2.p137 Clean build of ruby with openssl 1.1.1i on OSX Here is a minimal reproduction of the issue: https://github.com/Andy-Bell/mqtt-error-from-pr-134

Expected outcome:

Current outcome

njh commented 3 years ago

Thanks for reporting this.

I am not sure if the best thing to do is: 1) Just revert #134 2) Attempt to monkey-patch OpenSSL::SSL::SSLSocket, so that it support #getbyte

What do you think @tenderlove ?

tenderlove commented 3 years ago

I think we should monkeypatch OpenSSL. If normal sockets support getbyte, and SSLSocket doesn't, then I think it's a bug in SSLSocket. I've sent a patch upstream. I'll try making a patch for ruby-mqtt, but I might need a day or two.

njh commented 3 years ago

@tenderlove fantastic! Thank you very much!

Andy-Bell commented 3 years ago

Thanks both

njh commented 2 years ago

Hi @tenderlove. Do you think you might have time to create a patch for the lack of #getbyte in ruby-mqtt?

Would be good to make a new release of this gem.

tenderlove commented 2 years ago

@njh I'm so sorry. I totally forgot to do this. I've done it and sent a PR #139

🙇