FreeRTOS:
HTTPS Client
HTTPS Client v1.0.0 library
|
Return to main page ↑ |
Add a header to the current HTTPS request represented by reqHandle.
The header line is appended to the request header buffer space in IotHttpsRequestInfo_t.userBuffer. Please see requestUserBufferMinimumSize for information about sizing the IotHttpsRequestInfo_t.userBuffer so that this function does not fail.
Header lines are appended in the following format:
Example:
The last header line must be followed by a "\r\n" to separate the last header line from the entity body. These 2 characters are accounted for in requestUserBufferMinimumSize.
The remaining length, after the header is added, is printed to the system configured standard debug output when IOT_LOG_LEVEL_HTTPS is set to IOT_LOG_DEBUG in iot_config.h.
For an asynchronous request, this function can be invoked before the request is sent with IotHttpsClient_SendAsync, or during IotHttpsClientCallbacks_t.appendHeaderCallback. It is recommended to invoke this function in IotHttpsClientCallbacks_t.appendHeaderCallback.
Asynchronous Example
For a synchronous request, if extra headers are desired to be added, this function must be invoked before IotHttpsClient_SendSync. Synchronous Example
The following header fields are automatically added to the request header buffer and must NOT be added again with this routine:
The reqHandle is not thread safe. If two threads have the same reqHandle and attempt to add headers at the same time, garbage strings may be written to the reqHandle.
[in] | reqHandle | - HTTPS request to write the header line to. |
[in] | pName | - String header field name to write. |
[in] | nameLen | - The length of the header name to write. |
[in] | pValue | - https header value buffer pointer. Do not include token name. |
[in] | valueLen | - length of header value to write. |