coreHTTP  v2.0.0
HTTP/1.1 Client Library

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.

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.
[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.
One of the following:


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,
sizeof("Date") - 1,
&dateLen );
@ HTTPSuccess
The HTTP Client library function completed successfully.
Definition: core_http_client.h:167
Represents an HTTP response.
Definition: core_http_client.h:428
The HTTP Client library return status.
Definition: core_http_client.h:156
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:2459