mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-07 02:02:54 +03:00
coap_net: skip Content-Format check for OSCORE FETCH
When a FETCH request is OSCORE-protected the Content-Format option is an inner (encrypted) option per RFC 8613 §4.1.3.1 and is legitimately absent from the outer CoAP message. The existing RFC 8132 §2.3.1 check unconditionally rejects such requests with 4.15 (Unsupported Content-Format) even when COAP_OSCORE_SUPPORT is disabled and the application uses its own OSCORE stack. Only enforce the Content-Format presence rule when no OSCORE option is present in the outer request. Fixes: https://github.com/obgm/libcoap/issues/1936
This commit is contained in:
1 parent
a307ef9467
commit
0a48ceec41
1 file changed
+7
-5
+7
-5
@@ -3859,11 +3859,13 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu
|
||||
goto fail_response;
|
||||
}
|
||||
if (pdu->code == COAP_REQUEST_CODE_FETCH) {
|
||||
opt = coap_check_option(pdu, COAP_OPTION_CONTENT_FORMAT, &opt_iter);
|
||||
if (opt == NULL) {
|
||||
/* RFC 8132 2.3.1 */
|
||||
resp = 415;
|
||||
goto fail_response;
|
||||
if (coap_check_option(pdu, COAP_OPTION_OSCORE, &opt_iter) == NULL) {
|
||||
opt = coap_check_option(pdu, COAP_OPTION_CONTENT_FORMAT, &opt_iter);
|
||||
if (opt == NULL) {
|
||||
/* RFC 8132 2.3.1 */
|
||||
resp = 415;
|
||||
goto fail_response;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context->mcast_per_resource &&
|
||||
|
||||
Reference in new issue
Block a user