adafruit / Adafruit_CircuitPython_MiniMQTT

MQTT Client Library for CircuitPython
Other
73 stars 50 forks source link

allow to use any port as TLS port #145

Closed vladak closed 1 year ago

vladak commented 1 year ago

Instead of using the MQTT_TLS_PORT value as indication whether TLS should be used, this change introduces private field that is set based on the MQTT() is_ssl argument.

The downside of this approach is that if someone specifies port=1883 explicitly without setting is_ssl to False, the port will be treated as TLS port since the is_ssl is True by default and OSError("Failed SSL handshake") will be thrown, unless the broker is configured to accept TLS on that port. I have not made my mind yet whether to special case it and force to insecure so leaving it open for the reviewers.