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
Calling Client::subscribe_many with an empty topic list causes it to send a subscribe packet without any topic filter. According to [MQTT-3.8.3-3] "The payload of a SUBSCRIBE packet MUST contain at least one Topic Filter / QoS pair. A SUBSCRIBE packet with no payload is a protocol violation". v5 has the same requirement. When the broker gets this message is closes the connection due to a malformed packet.
This affects try_subscribe_many as well
Client::subscribe_many should return an error when called with an empty topic list
I haven't looked into rumqttd but it shouldn't accept these empty subscribe messages
Test setup
rumqttc v0.12.0
mosquitto version 2.0.14
Test code
use rumqttc::{Client, MqttOptions};
fn main() {
let mqttoptions = MqttOptions::new("rumqtt-sync", "localhost", 1883);
let (mut client, mut connection) = Client::new(mqttoptions, 10);
client.subscribe_many(Vec::new()).unwrap();
for notification in connection.iter() {
println!("Notification = {:?}", notification);
}
}
mosquitto[2575]: 1650909678: New connection from ::1:39042 on port 1883.
mosquitto[2575]: 1650909678: New client connected from ::1:39042 as rumqtt-sync (p2, c1, k60).
mosquitto[2575]: 1650909678: Client rumqtt-sync disconnected due to malformed packet.
Packet
The text was updated successfully, but these errors were encountered:
Thank you for pointing this out @KisImre. I have opened a branch to work on a possible solution to this. Do let me know your thoughts on the included changes.
Description
Calling
Client::subscribe_many
with an empty topic list causes it to send a subscribe packet without any topic filter. According to [MQTT-3.8.3-3] "The payload of a SUBSCRIBE packet MUST contain at least one Topic Filter / QoS pair. A SUBSCRIBE packet with no payload is a protocol violation". v5 has the same requirement. When the broker gets this message is closes the connection due to a malformed packet.try_subscribe_many
as wellClient::subscribe_many
should return an error when called with an empty topic listTest setup
rumqttc v0.12.0
mosquitto version 2.0.14
Test code
Output
Broker log
Packet
The text was updated successfully, but these errors were encountered: