body_size: Support configuration of max supported body size for RFC7959

Function coap_context_set_max_body_size() added.

For servers, if body size is too large, a 4.13 response is generated.

For clients, if the body size is too large, the server gets a RST and
no date is passed to the application.  A new event COAP_EVENT_BLOCK_ISSUE
is generated.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2026-01-29 09:53:52 +00:00
1 parent 6c0be0c898
commit 07c7a7aa57
13 files changed
+150 -9

No files matched your search

+3
View File
@@ -371,6 +371,7 @@ event_handler(coap_session_t *session COAP_UNUSED,
case COAP_EVENT_WS_PACKET_SIZE:
case COAP_EVENT_WS_CLOSED:
case COAP_EVENT_BAD_PACKET:
case COAP_EVENT_BLOCK_ISSUE:
quit = 1;
break;
case COAP_EVENT_FIRST_PDU_FAIL:
@@ -402,6 +403,8 @@ event_handler(coap_session_t *session COAP_UNUSED,
default:
break;
}
if (quit)
coap_send_recv_terminate();
return 0;
}
+1
View File
@@ -1117,6 +1117,7 @@ proxy_event_handler(coap_session_t *session COAP_UNUSED,
case COAP_EVENT_SESSION_FAILED:
case COAP_EVENT_PARTIAL_BLOCK:
case COAP_EVENT_XMIT_BLOCK_FAIL:
case COAP_EVENT_BLOCK_ISSUE:
case COAP_EVENT_SERVER_SESSION_NEW:
case COAP_EVENT_SERVER_SESSION_DEL:
case COAP_EVENT_SERVER_SESSION_CONNECTED: