Azure / azure-iot-middleware-freertos

Azure IoT Middleware for FreeRTOS
https://azure.github.io/azure-iot-middleware-freertos/
MIT License
80 stars 24 forks source link

coreHTTP Init functions do not handle HTTPClient_InitializeRequestHeaders return code #312

Open gfurtadoalmeida opened 1 year ago

gfurtadoalmeida commented 1 year ago

Is there an existing issue for this?

Version

1.1.0

Description of the issue

On coreHTTP the following Init functions do not handle the HTTPClient_InitializeRequestHeaders return code, therefore always succeeding, even when it should fail:

This behavior is confusing because those Init functions return success even if HTTPClient_InitializeRequestHeaders cannot write the request headers. Without request headers, Send functions will raise this error:

Parameter check failed: pRequestHeaders->headersLen does not meet minimum the required length. MinimumRequiredLength=16, HeadersLength=0

Expected behavior

The following Init functions should handle the HTTPClient_InitializeRequestHeaders return code, succeeding only when the headers are written:

Steps to reproduce the issue

Call AzureIoTHTTP_RequestSizeInit or AzureIoTHTTP_Init with a header buffer with 10 bytes of size. It will succeed even though there is not enough space to write the headers.

Relevant log output

No response

Code of Conduct