Skip to content

Commit fe80b67

Browse files
author
Jani Suonpera
committed
Update CoAP to 4.0.11
This PR implement https://tools.ietf.org/html/rfc7959#section-2.5 "The error code 4.13 (Request Entity Too Large) can be returned at any time by a server that does not currently have the resources to store blocks for a block-wise request payload transfer that it would intend to implement in an atomic fashion. (Note that a 4.13 response to a request that does not employ Block1 is a hint for the client to try sending Block1, and a 4.13 response with a smaller SZX in its Block1 Option than requested is a hint to try a smaller SZX.)
1 parent 635a824 commit fe80b67

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

features/FEATURE_COMMON_PAL/mbed-coap/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mbed-coap",
3-
"version": "4.0.10",
3+
"version": "4.0.11",
44
"description": "COAP library",
55
"keywords": [
66
"coap",

features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_protocol.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,15 @@ static sn_coap_hdr_s *sn_coap_handle_blockwise_message(struct coap_s *handle, sn
17561756

17571757
/* Check block size */
17581758
block_temp = (src_coap_blockwise_ack_msg_ptr->options_list_ptr->block1 & 0x07);
1759+
uint16_t block_size = 1u << (block_temp + 4);
1760+
if (block_size > handle->sn_coap_block_data_size) {
1761+
// Include maximum size that stack can handle into response
1762+
tr_error("sn_coap_handle_blockwise_message - (recv block1) COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_TOO_LARGE!");
1763+
src_coap_blockwise_ack_msg_ptr->msg_code = COAP_MSG_CODE_RESPONSE_REQUEST_ENTITY_TOO_LARGE;
1764+
src_coap_blockwise_ack_msg_ptr->options_list_ptr->size1 = handle->sn_coap_block_data_size;
1765+
sn_coap_protocol_linked_list_blockwise_payload_remove_oldest(handle);
1766+
}
1767+
17591768
if (block_temp > sn_coap_convert_block_size(handle->sn_coap_block_data_size)) {
17601769
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block1 &= 0xFFFFF8;
17611770
src_coap_blockwise_ack_msg_ptr->options_list_ptr->block1 |= sn_coap_convert_block_size(handle->sn_coap_block_data_size);

0 commit comments

Comments
 (0)