diff --git a/net/blockwise/blockwise.go b/net/blockwise/blockwise.go index 1828d75e..c828b97e 100644 --- a/net/blockwise/blockwise.go +++ b/net/blockwise/blockwise.go @@ -386,6 +386,10 @@ func (b *BlockWise[C]) handleReceivedMessage(w *responsewriter.ResponseWriter[C] next(w, r) return nil case codes.GET, codes.DELETE: + // For GET and DELETE requests in CoAP, the initial request cannot have the message type of Acknowledge (ACK) or Reset (RST) + if r.Type() == message.Acknowledgement || r.Type() == message.Reset { + return fmt.Errorf("invalid message type(%v) for code(%v)", r.Type(), r.Code()) + } maxSZX = fitSZX(r, message.Block2, maxSZX) block, errG := r.GetOptionUint32(message.Block2) if errG == nil {