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 );
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:2513
HTTPStatus_t
The HTTP Client library return status.
Definition: core_http_client.h:164
Represents an HTTP response.
Definition: core_http_client.h:427
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] | pResponse | The buffer containing the completed HTTP response. |
[in] | pField | The header field name to read. |
[in] | fieldLen | The length of the header field name in bytes. |
[out] | pValueLoc | This will be populated with the location of the header value in the response buffer, HTTPResponse_t.pBuffer. |
[out] | pValueLen | This will be populated with the length of the header value in bytes. |
- Returns
- One of the following:
Example
char * pDateLoc = NULL;
size_t dateLen = 0;
"Date",
sizeof("Date") - 1,
&pDateLoc,
&dateLen );
@ HTTPSuccess
The HTTP Client library function completed successfully.
Definition: core_http_client.h:175