Skip to content

Commit

Permalink
Permit Will Message properties in CONNECT packet
Browse files Browse the repository at this point in the history
A CONNECT packet has own properties, but may also include a separate set of Will Properties. Previously the Will Properties were mostly being rejected as invalid.
  • Loading branch information
MattBrittan authored Oct 15, 2023
2 parents 9e9e579 + db67737 commit 61d7496
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packets/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,14 @@ func (i *Properties) Unpack(r *bytes.Buffer, p byte) error {

// ValidProperties is a map of the various properties and the
// PacketTypes that property is valid for.
// A CONNECT packet has own properties, but may also include a separate set of Will Properties.
// Currently, `CONNECT` covers both sets, this may lead to some invalid properties being accepted (this may be fixed in the future).
var ValidProperties = map[byte]map[byte]struct{}{
PropPayloadFormat: {PUBLISH: {}},
PropMessageExpiry: {PUBLISH: {}},
PropContentType: {PUBLISH: {}},
PropResponseTopic: {PUBLISH: {}},
PropCorrelationData: {PUBLISH: {}},
PropPayloadFormat: {CONNECT: {}, PUBLISH: {}},
PropMessageExpiry: {CONNECT: {}, PUBLISH: {}},
PropContentType: {CONNECT: {}, PUBLISH: {}},
PropResponseTopic: {CONNECT: {}, PUBLISH: {}},
PropCorrelationData: {CONNECT: {}, PUBLISH: {}},
PropTopicAlias: {PUBLISH: {}},
PropSubscriptionIdentifier: {PUBLISH: {}, SUBSCRIBE: {}},
PropSessionExpiryInterval: {CONNECT: {}, CONNACK: {}, DISCONNECT: {}},
Expand Down

0 comments on commit 61d7496

Please sign in to comment.