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
A client that has the will flag set, a will topic specified but an empty will message is rejected by the broker with the error message "will flag set, but will topic/message not present in payload".
It seems the code is confusing an empty will message (i.e. field present but with the length set to 0, which is valid) with the absence of the field (which is not according to the spec).
A change like below seems to fix it but I'm not 100% sure this is indeed the right fix:
diff --git a/amqtt/codecs.py b/amqtt/codecs.py
index 45cb7c5..1057fa6 100644
--- a/amqtt/codecs.py
+++ b/amqtt/codecs.py
@@ -83,7 +83,10 @@ async def decode_data_with_length(reader) -> bytes:
"""
length_bytes = await read_or_raise(reader, 2)
bytes_length = unpack("!H", length_bytes)
- data = await read_or_raise(reader, bytes_length[0])
+ if bytes_length[0]:
+ data = await read_or_raise(reader, bytes_length[0])
+ else:
+ data = b""
return data
The text was updated successfully, but these errors were encountered:
A client that has the
will flag
set, awill topic
specified but an emptywill message
is rejected by the broker with the error message"will flag set, but will topic/message not present in payload"
.It seems the code is confusing an empty
will message
(i.e. field present but with the length set to 0, which is valid) with the absence of the field (which is not according to the spec).A change like below seems to fix it but I'm not 100% sure this is indeed the right fix:
The text was updated successfully, but these errors were encountered: