coreHTTP  v2.0.2
HTTP/1.1 Client Library
HTTPClient_AddHeader

Add a header to the request headers stored in HTTPRequestHeaders_t.pBuffer.

const char * pField,
size_t fieldLen,
const char * pValue,
size_t valueLen );

Upon return, pRequestHeaders->headersLen will be updated with the number of bytes written.

Headers are written in the following format:

<field>: <value>\r\n\r\n

The trailing \r\n that denotes the end of the header lines is overwritten, if it already exists in the buffer.

Note
This function validates only that \r, \n, and : are not present in pValue or pField. : is allowed in pValue.
Parameters
[in]pRequestHeadersRequest header buffer information.
[in]pFieldThe header field name to write. The data should be ISO 8859-1 (Latin-1) encoded per the HTTP standard, but the API does not perform the character set validation.
[in]fieldLenThe byte length of the header field name.
[in]pValueThe header value to write. The data should be ISO 8859-1 (Latin-1) encoded per the HTTP standard, but the API does not perform the character set validation.
[in]valueLenThe byte length of the header field value.
Returns
One of the following:

Example

HTTPStatus_t httpLibraryStatus = HTTPSuccess;
// Assume that requestHeaders has already been initialized with
// HTTPClient_InitializeRequestHeaders().
HTTPRequestHeaders_t requestHeaders;
httpLibraryStatus = HTTPClient_AddHeader( &requestHeaders,
"Request-Header-Field",
sizeof( "Request-Header-Field" ) - 1U,
"Request-Header-Value",
sizeof("Request-Header-Value") - 1U );
HTTPSuccess
@ HTTPSuccess
The HTTP Client library function completed successfully.
Definition: core_http_client.h:173
HTTPRequestHeaders_t
Represents header data that will be sent in an HTTP request.
Definition: core_http_client.h:329
HTTPClient_AddHeader
HTTPStatus_t HTTPClient_AddHeader(HTTPRequestHeaders_t *pRequestHeaders, const char *pField, size_t fieldLen, const char *pValue, size_t valueLen)
Add a header to the request headers stored in HTTPRequestHeaders_t.pBuffer.
Definition: core_http_client.c:1654
HTTPStatus_t
HTTPStatus_t
The HTTP Client library return status.
Definition: core_http_client.h:162