mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-05 18:50:06 +08:00
Set max_packet_size to 2,000,000 bytes by default
This commit is contained in:
@@ -15,6 +15,10 @@
|
||||
|
||||
## Behaviour changes
|
||||
|
||||
- max_packet_size now defaults to 2,000,000 bytes instead of the 256MB MQTT
|
||||
limit. If you are using payloads that will result in a packet larger than
|
||||
this, you need to manually set the option to a value that suits your
|
||||
application.
|
||||
- acl_file and password_file will produce an error on invalid input when
|
||||
reloading the config, causing the broker to quit.
|
||||
|
||||
|
||||
@@ -833,7 +833,11 @@ log_timestamp_format %Y-%m-%dT%H:%M:%S
|
||||
clients regardless of the protocol version they are
|
||||
using, but v3.1.1 and earlier clients will of course
|
||||
not have received the maximum packet size information.
|
||||
Defaults to no limit.</para>
|
||||
</para>
|
||||
<para>
|
||||
Defaults to 2000000 bytes since 2.1. Earlier versions
|
||||
defaulted to no limit.
|
||||
</para>
|
||||
|
||||
<para>This option applies to all clients, not just those
|
||||
using MQTT v5, but it is not possible to notify clients
|
||||
|
||||
@@ -335,7 +335,7 @@ static void config__init_reload(struct mosquitto__config *config)
|
||||
config->global_max_connections = -1;
|
||||
config->log_timestamp_format = NULL;
|
||||
config->max_keepalive = 0;
|
||||
config->max_packet_size = 0;
|
||||
config->max_packet_size = 2000000;
|
||||
config->max_inflight_messages = 20;
|
||||
config->max_queued_messages = 1000;
|
||||
config->max_inflight_bytes = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ def do_test(config_func, client_port, auto_id):
|
||||
# Remove the "xxxx" part - this means the front part of the packet
|
||||
# is correct (so remaining length etc. is correct), but we don't
|
||||
# need to match against the random id.
|
||||
connack_packet = connack_packet[:-39]
|
||||
connack_packet = connack_packet[:-44]
|
||||
|
||||
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port1, use_conf=True)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ def do_test(per_listener, proto_ver, clean_start, allow_zero, client_port, expec
|
||||
# Remove the "xxxx" part - this means the front part of the packet
|
||||
# is correct (so remaining length etc. is correct), but we don't
|
||||
# need to match against the random id.
|
||||
connack_packet = connack_packet[:-39]
|
||||
connack_packet = connack_packet[:-44]
|
||||
|
||||
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port1, use_conf=True)
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ def do_test(publish_packet, reason_code, error_string):
|
||||
|
||||
connack_props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10)
|
||||
connack_props += mqtt5_props.gen_byte_prop(mqtt5_props.RETAIN_AVAILABLE, 0)
|
||||
connack_props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000)
|
||||
connack_props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
connack_props += mqtt5_props.gen_byte_prop(mqtt5_props.MAXIMUM_QOS, 1)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ def do_test(proto_ver):
|
||||
sub_connect_packet = mosq_test.gen_connect("sub", properties=properties, proto_ver=proto_ver, clean_session=False)
|
||||
|
||||
properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1)
|
||||
sub_connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False)
|
||||
sub_connack_packet2 = mosq_test.gen_connack(rc=0, flags=1, proto_ver=proto_ver, properties=properties, property_helper=False)
|
||||
@@ -28,6 +29,7 @@ def do_test(proto_ver):
|
||||
|
||||
connect_packet = mosq_test.gen_connect("pub-qos1-test", proto_ver=proto_ver)
|
||||
properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False)
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ def do_test(proto_ver):
|
||||
rc = 1
|
||||
connect_packet = mosq_test.gen_connect("pub-qos1-test", proto_ver=proto_ver)
|
||||
properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ def do_test(proto_ver):
|
||||
rc = 1
|
||||
connect_packet = mosq_test.gen_connect("pub-qos2-test", proto_ver=proto_ver)
|
||||
properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False)
|
||||
|
||||
|
||||
@@ -18,10 +18,8 @@ props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat")
|
||||
props += mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_DATA, "repeat")
|
||||
connect_packet = mosq_test.gen_connect("client-params-test", proto_ver=5, properties=props)
|
||||
|
||||
props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10)
|
||||
props += mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat")
|
||||
props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False)
|
||||
props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat")
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props)
|
||||
|
||||
# Reauthentication fails
|
||||
props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat")
|
||||
|
||||
@@ -17,8 +17,10 @@ write_config(conf_file, port)
|
||||
rc = 1
|
||||
|
||||
connect_packet = mosq_test.gen_connect("12-max-packet-broker", proto_ver=5)
|
||||
props = mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 40)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props)
|
||||
props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10)
|
||||
props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 40)
|
||||
props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False)
|
||||
|
||||
publish_packet = mosq_test.gen_publish("12/max/packet/size/broker/test/topic", qos=0, payload="0123456789012345678901234567890", proto_ver=5)
|
||||
disconnect_packet = mosq_test.gen_disconnect(reason_code=149, proto_ver=5)
|
||||
|
||||
@@ -24,6 +24,7 @@ connect_packet = mosq_test.gen_connect("12-server-keepalive", proto_ver=5, keepa
|
||||
|
||||
props = mqtt5_props.gen_uint16_prop(mqtt5_props.SERVER_KEEP_ALIVE, 60) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False)
|
||||
|
||||
|
||||
@@ -145,14 +145,14 @@
|
||||
"tests": [
|
||||
{ "name": "10 ok ", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r14 s4 'MQTT' 05 02 k10 v0 s1 'p'", "comment":"minimal valid CONNECT"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "10 remaining length 5 bytes", "msgs":[
|
||||
{"type":"send", "payload":"10 r268435456 s4 'MQTT' 05 02 k10 s1 'p'", "comment":"CONNECT"}
|
||||
]},
|
||||
{ "name": "10 Username flag 1 ok", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r17 s4 'MQTT' 05 82 k10 v0 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "10 Client ID with 0x0000", "msgs": [
|
||||
{"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 v0 s5 746F700000"},
|
||||
@@ -219,7 +219,7 @@
|
||||
]},
|
||||
{ "name": "10 Will flag 1 ok", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r21 s4 'MQTT' 05 06 k10 v0 s1 'p' 00 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "tiny max packet", "msgs":[{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 L2 s1 'p'"}]}
|
||||
]
|
||||
@@ -242,7 +242,7 @@
|
||||
"tests": [
|
||||
{ "name": "session-expiry-interval (four byte integer)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 11 L1 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*session-expiry-interval (four byte integer)", "msgs":[
|
||||
{"type":"send", "payload":"10 r24 s4 'MQTT' 05 02 k10 0A 11 L1 11 L1 s1 'p'"},
|
||||
@@ -255,7 +255,7 @@
|
||||
|
||||
{ "name": "receive-maximum (two byte integer)", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 21 0101 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "receive-maximum (two byte integer) 0 value", "msgs": [
|
||||
{"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 21 0000 s1 'p'"},
|
||||
@@ -272,7 +272,7 @@
|
||||
|
||||
{ "name": "maximum-packet-size (four byte integer)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 10000001 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*maximum-packet-size (four byte integer)", "msgs":[
|
||||
{"type":"send", "payload":"10 r24 s4 'MQTT' 05 02 k10 0A 27 10000001 27 10000001 s1 'p'"},
|
||||
@@ -288,16 +288,16 @@
|
||||
]},
|
||||
{ "name": "maximum-packet-size (four byte integer) FFFFFFFF value", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 FFFFFFFF s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
|
||||
{ "name": "topic-alias-maximum (two byte integer)", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 22 0101 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "topic-alias-maximum (two byte integer) 0 value", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 22 0000 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*topic-alias-maximum (two byte integer)", "msgs": [
|
||||
{"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 22 0101 22 0101 s1 'p'"},
|
||||
@@ -310,7 +310,7 @@
|
||||
|
||||
{ "name": "request-response-information (byte)", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r16 s4 'MQTT' 05 02 k10 02 19 01 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*request-response-information (byte)", "msgs": [
|
||||
{"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 19 01 19 01 s1 'p'"},
|
||||
@@ -327,7 +327,7 @@
|
||||
|
||||
{ "name": "request-problem-information (byte)", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r16 s4 'MQTT' 05 02 k10 02 17 01 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*request-problem-information (byte)", "msgs": [
|
||||
{"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 17 01 17 01 s1 'p'"},
|
||||
@@ -344,11 +344,11 @@
|
||||
|
||||
{ "name": "user-property", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r21 s4 'MQTT' 05 02 k10 07 26 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*user-property", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r28 s4 'MQTT' 05 02 k10 0E 26 s1 'p' s1 'p' 26 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property missing value", "msgs": [
|
||||
{"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 26 s1 'p' s1 'p'"},
|
||||
@@ -360,15 +360,15 @@
|
||||
]},
|
||||
{ "name": "user-property empty key", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 26 0000 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property empty value", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 26 s1 'p' 0000 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property empty key,value", "expect_disconnect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 26 0000 0000 s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
|
||||
{ "name": "authentication-method (UTF-8 string) missing", "msgs": [
|
||||
@@ -705,7 +705,7 @@
|
||||
"tests": [
|
||||
{ "name": "payload-format-indicator (byte)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r23 s4 'MQTT' 05 06 k10 v0 s1 'p' 02 01 01 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "payload-format-indicator (byte) missing", "msgs":[
|
||||
{"type":"send", "payload":"10 r22 s4 'MQTT' 05 06 k10 v0 s1 'p' 01 01 s1 'p' s1 'p'"},
|
||||
@@ -718,7 +718,7 @@
|
||||
|
||||
{ "name": "message-expiry-interval (four byte integer)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 02 L1 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*message-expiry-interval (four byte integer)", "msgs":[
|
||||
{"type":"send", "payload":"10 r31 s4 'MQTT' 05 06 k10 v0 s1 'p' 0A 02 L1 02 L1 s1 'p' s1 'p'"},
|
||||
@@ -731,7 +731,7 @@
|
||||
|
||||
{ "name": "will-delay-interval (four byte integer)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 18 L1 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "will-delay-interval (four byte integer)", "msgs":[
|
||||
{"type":"send", "payload":"10 r31 s4 'MQTT' 05 06 k10 v0 s1 'p' 0A 18 L1 18 L1 s1 'p' s1 'p'"},
|
||||
@@ -744,7 +744,7 @@
|
||||
|
||||
{ "name": "content-type (UTF-8 string)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 03 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*content-type (UTF-8 string)", "msgs":[
|
||||
{"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 03 s1 'p' 03 s1 'p' s1 'p' s1 'p'"},
|
||||
@@ -756,12 +756,12 @@
|
||||
]},
|
||||
{ "name": "content-type (UTF-8 string) empty", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r24 s4 'MQTT' 05 06 k10 v0 s1 'p' 03 03 0000 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
|
||||
{ "name": "response-topic (UTF-8 string)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 08 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*response-topic (UTF-8 string)", "msgs":[
|
||||
{"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 08 s1 'p' 08 s1 'p' s1 'p' s1 'p'"},
|
||||
@@ -778,7 +778,7 @@
|
||||
|
||||
{ "name": "correlation-data (binary)", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 09 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*correlation-data (binary)", "msgs":[
|
||||
{"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 09 s1 'p' 09 s1 'p' s1 'p' s1 'p'"},
|
||||
@@ -790,16 +790,16 @@
|
||||
]},
|
||||
{ "name": "correlation-data (binary) empty", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r24 s4 'MQTT' 05 06 k10 v0 s1 'p' 03 09 0000 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
|
||||
{ "name": "user-property", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r28 s4 'MQTT' 05 06 k10 v0 s1 'p' 07 26 s1 'p' s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "2*user-property", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r35 s4 'MQTT' 05 06 k10 v0 s1 'p' 0E 26 s1 'p' s1 'p' 26 s1 'p' s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property missing value", "msgs":[
|
||||
{"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 26 s1 'p' s1 'p' s1 'p'"},
|
||||
@@ -811,15 +811,15 @@
|
||||
]},
|
||||
{ "name": "user-property empty key", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r27 s4 'MQTT' 05 06 k10 v0 s1 'p' 06 26 0000 s1 'p' s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property empty value", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r27 s4 'MQTT' 05 06 k10 v0 s1 'p' 06 26 s1 'p' 0000 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]},
|
||||
{ "name": "user-property empty key,value", "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 26 0000 0000 s1 'p' s1 'p'"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"}
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}
|
||||
]}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
]},
|
||||
{ "name": "E0 non-zero session expiry", "connect":false, "msgs": [
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 11 L0 s1 'p'", "comment":"CONNECT with session expiry=0"},
|
||||
{"type":"recv", "payload":"20 r9 00000622000A210014", "comment": "CONNACK"},
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"},
|
||||
{"type":"send", "payload":"E0 r7 00 05 11 L1"},
|
||||
{"type":"recv", "payload":"E0 r1 82"}
|
||||
]}
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
"tests": [
|
||||
{ "name": "maximum packet size", "connect":false, "expect_disconnect":false, "msgs":[
|
||||
{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 v5 2700000014 s1 'p'", "comment":"CONNECT with max-packet-size 20"},
|
||||
{"type":"recv", "payload":"20 r9 00 00 06 22000A210014", "comment": "CONNACK"},
|
||||
{"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"},
|
||||
{"type":"send", "payload":"82 r11 m1234 v0 s5 'topic' 00", "comment":"SUBSCRIBE topic"},
|
||||
{"type":"recv", "payload":"90 r4 m1234 v0 00", "comment":"SUBACK"},
|
||||
{"type":"send", "payload":"30 r22 s5 'topic' v0 'payloadpayload'", "comment":"PUBLISH with size > 20"},
|
||||
|
||||
@@ -8,8 +8,10 @@ from mosq_test_helper import *
|
||||
|
||||
def do_test(conn, data):
|
||||
connect_packet = mosq_test.gen_connect("publish-qos0-test", proto_ver=5)
|
||||
props = mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 30)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props)
|
||||
props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10)
|
||||
props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 30)
|
||||
props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False)
|
||||
|
||||
bad_publish_packet = mosq_test.gen_publish("pub/test", qos=0, payload="0123456789012345678", proto_ver=5)
|
||||
publish_packet = mosq_test.gen_publish("pub/test", qos=0, payload="012345678901234567", proto_ver=5)
|
||||
|
||||
@@ -676,7 +676,9 @@ def gen_connack(flags=0, rc=0, proto_ver=4, properties=b"", property_helper=True
|
||||
if property_helper == True:
|
||||
if properties is not None:
|
||||
properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \
|
||||
+ properties + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
+ properties \
|
||||
+ mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \
|
||||
+ mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20)
|
||||
else:
|
||||
properties = b""
|
||||
properties = mqtt5_props.prop_finalise(properties)
|
||||
|
||||
Reference in New Issue
Block a user