1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

suit/transport/coap: use coap_opt_put_uri()

The URI is passed as a string to `suit_coap_get_blockwise()`.
It may contain query parameters, those will not be translated
properly to CoAP options if `coap_opt_put_uri_path()` is used.

Instead use `coap_opt_put_uri()` to handle both path and query
parameters.
This commit is contained in:
Benjamin Valentin 2021-01-21 15:40:40 +01:00
parent d4e5c25b70
commit 769978904a

View File

@ -198,14 +198,15 @@ static int _fetch_block(coap_pkt_t *pkt, uint8_t *buf, sock_udp_t *sock,
const char *path, coap_blksize_t blksize, size_t num)
{
uint8_t *pktpos = buf;
uint16_t lastonum = 0;
pkt->hdr = (coap_hdr_t *)buf;
pktpos += coap_build_hdr(pkt->hdr, COAP_TYPE_CON, NULL, 0, COAP_METHOD_GET,
num);
pktpos += coap_opt_put_uri_path(pktpos, 0, path);
pktpos += coap_opt_put_uri_pathquery(pktpos, &lastonum, path);
pktpos +=
coap_opt_put_uint(pktpos, COAP_OPT_URI_PATH, COAP_OPT_BLOCK2,
coap_opt_put_uint(pktpos, lastonum, COAP_OPT_BLOCK2,
(num << 4) | blksize);
pkt->payload = pktpos;