You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per the MQTT spec, AUTH packets with Reason Success are allowed to omit the body:
The Reason Code and Property Length can be omitted if the Reason Code is 0x00 (Success) and there are no Properties. In this case the AUTH has a Remaining Length of 0.
Therefore, the AUTH packet [0xf0, 0x00] is valid, as this has:
0xf0 : AUTH header
0x00 : Remaining length = 0
Describe the bug
MQTTnet doesn't accept these packets. It throws an exception when trying to parse these packets:
MQTTnet.Exceptions.MqttProtocolViolationException: Data from the body is required but not present.
at MQTTnet.Formatter.V5.MqttV5PacketDecoder.ThrowIfBodyIsEmpty(ArraySegment`1 body)
at MQTTnet.Formatter.V5.MqttV5PacketDecoder.DecodeAuthPacket(ArraySegment`1 body)
at MQTTnet.Formatter.V5.MqttV5PacketDecoder.Decode(ReceivedMqttPacket receivedMqttPacket)
at MQTTnet.Formatter.V5.MqttV5PacketFormatter.Decode(ReceivedMqttPacket receivedMqttPacket)
at MQTTnet.Formatter.MqttPacketFormatterAdapter.Decode(ReceivedMqttPacket receivedMqttPacket)
at MQTTnet.Adapter.MqttChannelAdapter.ReceivePacketAsync(CancellationToken cancellationToken)
at MQTTnet.Client.MqttClient.Receive(CancellationToken cancellationToken)
at MQTTnet.Client.MqttClient.ReceivePacketsLoop(CancellationToken cancellationToken)
Which component is your bug related to?
Client
Expected behavior
The AUTH packet [0xf0, 0x02, 0x00, 0x00] works fine. This has:
0xf0 - AUTH header
0x02 - Remaining length = 2
0x00 - Reason Success
0x00 - Property length = 0
Per the MQTT spec, the AUTH packets [0xf0, 0x00] and [0xf0, 0x02, 0x00, 0x00] should be treated as equivalent, so both should work with MQTTnet.
The text was updated successfully, but these errors were encountered:
Verification
Per the MQTT spec, AUTH packets with Reason
Success
are allowed to omit the body:Therefore, the AUTH packet [0xf0, 0x00] is valid, as this has:
Describe the bug
MQTTnet doesn't accept these packets. It throws an exception when trying to parse these packets:
Which component is your bug related to?
Expected behavior
The AUTH packet [0xf0, 0x02, 0x00, 0x00] works fine. This has:
Success
Per the MQTT spec, the AUTH packets [0xf0, 0x00] and [0xf0, 0x02, 0x00, 0x00] should be treated as equivalent, so both should work with MQTTnet.
The text was updated successfully, but these errors were encountered: