coreHTTP  v2.0.2
HTTP/1.1 Client Library
HTTPClient_ReadHeader

Read a header from a buffer containing a complete HTTP response. This will return the location of the response header value in the HTTPResponse_t.pBuffer buffer.

const char * pField,
size_t fieldLen,
const char ** pValueLoc,
size_t * pValueLen );

The location, within HTTPResponse_t.pBuffer, of the value found, will be returned in pValue. If the header value is empty for the found pField, then this function will return HTTPSuccess, and set the values for pValueLoc and pValueLen as NULL and zero respectively. According to RFC 2616, it is not invalid to have an empty value for some header fields.

Note
This function should only be called on a complete HTTP response. If the request is sent through the HTTPClient_Send function, the HTTPResponse_t is incomplete until HTTPClient_Send returns.
Parameters
[in]pResponseThe buffer containing the completed HTTP response.
[in]pFieldThe header field name to read.
[in]fieldLenThe length of the header field name in bytes.
[out]pValueLocThis will be populated with the location of the header value in the response buffer, HTTPResponse_t.pBuffer.
[out]pValueLenThis will be populated with the length of the header value in bytes.
Returns
One of the following:

Example

HTTPStatus_t httpLibraryStatus = HTTPSuccess;
// Assume that response is returned from a successful invocation of
// HTTPClient_Send().
HTTPResponse_t response;
char * pDateLoc = NULL;
size_t dateLen = 0;
// Search for a "Date" header field. pDateLoc will be the location of the
// Date header value in response.pBuffer.
httpLibraryStatus = HTTPClient_ReadHeader( &response,
"Date",
sizeof("Date") - 1,
&pDateLoc,
&dateLen );
HTTPSuccess
@ HTTPSuccess
The HTTP Client library function completed successfully.
Definition: core_http_client.h:173
HTTPResponse_t
Represents an HTTP response.
Definition: core_http_client.h:434
HTTPStatus_t
HTTPStatus_t
The HTTP Client library return status.
Definition: core_http_client.h:162
HTTPClient_ReadHeader
HTTPStatus_t HTTPClient_ReadHeader(const HTTPResponse_t *pResponse, const char *pField, size_t fieldLen, const char **pValueLoc, size_t *pValueLen)
Read a header from a buffer containing a complete HTTP response. This will return the location of the...
Definition: core_http_client.c:2496