FreeRTOS: HTTPS Client
HTTPS Client v1.0.0 library
Return to main page ↑
IotHttpsClient_ReadResponseStatus

Retrieve the HTTPS response status.

The HTTP response status code is contained in the Status-Line of the response header buffer configured in IotHttpsResponseInfo_t.userBuffer. It is the first line of a standard HTTP response message. If the response Status-Line could not fit into IotHttpsResponseInfo_t.userBuffer, then this function will return an error code. Please see responseUserBufferMinimumSize for information about sizing the IotHttpsResponseInfo_t.userBuffer.

This routine can be used for both a synchronous and asynchronous response.

Example Synchronous Code

...
IotHttpsClient_SendSync(connHandle, reqHandle, &respHandle, &respInfo, timeout);
uint16_t status = 0;
IotHttpsClient_ReadResponseStatus(respHandle, &status);
if (status != IOT_HTTPS_STATUS_OK)
{
// Handle server response status.
}
...

For an asynchronous response the response status is the status parameter in IotHttpsClientCallbacks_t.readReadyCallback and IotHttpsClientCallbacks_t.responseCompleteCallback. The application should refer to that instead of using this function. Example Asynchronous Code

void applicationDefined_readReadyCallback(void * pPrivData, IotHttpsResponseHandle_t respHandle, IotHttpsReturnCode_t rc, uint16_t status)
{
...
if (status != IOT_HTTPS_STATUS_OK)
{
// Handle error server response status.
}
...
}
Parameters
[in]respHandle- Unique handle representing the HTTPS response.
[out]pStatus- Integer status returned by the server.
Returns
One of the following:
IotHttpsResponseHandle_t
struct _httpsResponse * IotHttpsResponseHandle_t
Opaque handle of an HTTP response.
Definition: iot_https_types.h:280
IotHttpsReturnCode_t
IotHttpsReturnCode_t
Return codes of HTTPS Client functions.
Definition: iot_https_types.h:294
IotHttpsClient_ReadResponseStatus
IotHttpsReturnCode_t IotHttpsClient_ReadResponseStatus(IotHttpsResponseHandle_t respHandle, uint16_t *pStatus)
Retrieve the HTTPS response status.
Definition: iot_https_client.c:3245