eclipse / paho.mqtt.testing

An Eclipse Paho project - a Python broker for testing
https://eclipse.org/paho
Other
108 stars 73 forks source link

MQTTV5 - Server should not send topic alias if the client has set topicAliasMax to 0 #45

Closed jpwsutton closed 6 years ago

jpwsutton commented 6 years ago

In this scenario, the client has connected without the Topic Alias Max property (Or has set it to 0), the broker still sends publishes with the Topic Alias set, in this case to 1 which is a protocol error.

INFO 20180220 112255 in: Connects(fh.DUP=False, fh.QoS=0, fh.RETAIN=False, ProtocolName=MQTT, ProtocolVersion=5, CleanStart=True, WillFlag=True, KeepAliveTimer=60, ClientId=, usernameFlag=False, passwordFlag=False, WillQoS=1, WillRETAIN=0, WillTopic='MQTT Examples', WillMessage='bytearray(b"I\'ve Disconnected, sorry!")', properties=[SessionExpiryInterval : 120])
.....
INFO 20180220 112255 out: Publishes(fh.DUP=False, fh.QoS=1, fh.RETAIN=False, PacketId=1, Properties: [TopicAlias : 1], TopicName=MQTT Examples, Payload=b'Message from MqttPublishSample')
icraggs commented 6 years ago

I just added a couple of tests to client_test5.py to test this (in the develop branch), and it all seems to work. Is there some other factor, I wonder?

icraggs commented 6 years ago

I've merged the PR into both develop and master, so I think this should be working now.

icraggs commented 6 years ago

Assuming it's working.