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
541 stars 135 forks source link

Add @hostname to SSL socket #89

Closed cdurante closed 7 years ago

cdurante commented 7 years ago

Add @hostname param to client to support server name indication (SNI).

njh commented 7 years ago

I have added SNI support in 3173302c89659d17e131c45c18f93da0b09488ea.

RFC3546 states:

If the server_name is established in the TLS session handshake, the client SHOULD NOT attempt to request a different server name at the application layer.

While MQTT doesn't have a way of giving the server name in the application layer - I think the ethos is the the client should pass the same hostname as it is trying to connect to.