[coap] block2 fix PrepareNextBlockRequest to provide token from next request (#12097)

This commit is contained in:
rwrozelle
2025-11-20 21:46:54 -08:00
committed by GitHub
parent ce1a751d62
commit ae5075682b
+2
View File
@@ -640,6 +640,8 @@ Error CoapBase::PrepareNextBlockRequest(Message::BlockType aType,
blockOption = (aType == Message::kBlockType1) ? kOptionBlock1 : kOptionBlock2;
aRequest.Init(kTypeConfirmable, static_cast<ot::Coap::Code>(aRequestOld.GetCode()));
// Per RFC 7959, all requests in a block-wise transfer MUST use the same token.
IgnoreError(aRequest.SetTokenFromMessage(aRequestOld));
SuccessOrExit(error = iterator.Init(aRequestOld));
// Copy options from last response to next message