Commit e2d38bd7 authored by Jozef Kralik's avatar Jozef Kralik Committed by Kishen Maloor

Fix: preserve ContentFormat for blockwise

Content format was dropped by commit:
 - coap:send last block2 response/block1 ACK as CON
   e5092dff
parent aa83bea8
Pipeline #150 passed with stage
in 51 seconds
......@@ -1268,7 +1268,7 @@ coap_set_token(void *packet, const uint8_t *token, size_t token_len)
return coap_pkt->token_len;
}
#ifdef OC_CLIENT
int
coap_get_header_content_format(void *packet, unsigned int *format)
{
......@@ -1280,7 +1280,7 @@ coap_get_header_content_format(void *packet, unsigned int *format)
*format = coap_pkt->content_format;
return 1;
}
#endif
int
coap_set_header_content_format(void *packet, unsigned int format)
{
......
......@@ -316,10 +316,15 @@ coap_receive(oc_message_t *msg)
goto send_message;
} else {
OC_DBG("received all blocks for payload");
unsigned int cf = 0;
int cf_was_set = coap_get_header_content_format(response, &cf);
coap_udp_init_message(response, COAP_TYPE_CON, CONTENT_2_05,
response->mid);
coap_set_header_block1(response, block1_num, block1_more,
block1_size);
if (cf_was_set) {
coap_set_header_content_format(response, cf);
}
request_buffer->payload_size =
request_buffer->next_block_offset;
request_buffer->ref_count = 0;
......@@ -359,8 +364,13 @@ coap_receive(oc_message_t *msg)
? 1
: 0;
if (more == 0) {
unsigned int cf = 0;
int cf_was_set = coap_get_header_content_format(response, &cf);
coap_udp_init_message(response, COAP_TYPE_CON, CONTENT_2_05,
response->mid);
if (cf_was_set) {
coap_set_header_content_format(response, cf);
}
}
coap_set_payload(response, payload, payload_size);
coap_set_header_block2(response, block2_num, more, block2_size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment