Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
HTTP response from the server. More...
#include <client.h>
Data Fields | |
const struct http_parser_settings * | http_cb |
HTTP parser settings for the application usage. | |
http_response_cb_t | cb |
User provided HTTP response callback which is called when a response is received to a sent HTTP request. | |
uint8_t * | body_frag_start |
Start address of the body fragment contained in the recv_buf. | |
size_t | body_frag_len |
Length of the body fragment contained in the recv_buf. | |
uint8_t * | recv_buf |
Where the response is stored, this is to be provided by the user. | |
size_t | recv_buf_len |
Response buffer maximum length. | |
size_t | data_len |
Length of the data in the result buf. | |
size_t | content_length |
HTTP Content-Length field value. | |
size_t | processed |
Amount of data given to the response callback so far, including the current data given to the callback. | |
char | http_status [HTTP_STATUS_STR_SIZE] |
See https://tools.ietf.org/html/rfc7230#section-3.1.2 for more information. | |
uint16_t | http_status_code |
Numeric HTTP status code which corresponds to the textual description. | |
uint8_t | cl_present: 1 |
Is Content-Length field present. | |
uint8_t | body_found: 1 |
Is message body found. | |
uint8_t | message_complete: 1 |
Is HTTP message parsing complete. | |
HTTP response from the server.
uint8_t http_response::body_found |
Is message body found.
size_t http_response::body_frag_len |
Length of the body fragment contained in the recv_buf.
uint8_t* http_response::body_frag_start |
Start address of the body fragment contained in the recv_buf.
recv_buffer that contains header + body _______________________________________ |←-------- body_frag_len ---------→| |←--------------------- data len --------------------→| --------------------------------------------------------------- ..header | header | body | body.. --------------------------------------------------------------- ↑ ↑ recv_buf body_frag_start recv_buffer that contains body only ___________________________________ |←------------------ body_frag_len ------------------→| |←--------------------- data len --------------------→| ---------------------------------------------------------------
↑ recv_buf body_frag_start
body_frag_start >= recv_buf body_frag_len = data_len - (body_frag_start - recv_buf)
http_response_cb_t http_response::cb |
User provided HTTP response callback which is called when a response is received to a sent HTTP request.
uint8_t http_response::cl_present |
Is Content-Length field present.
size_t http_response::content_length |
HTTP Content-Length field value.
Will be set to zero in the event of a null response.
size_t http_response::data_len |
Length of the data in the result buf.
If the value is larger than recv_buf_len, then it means that the data is truncated and could not be fully copied into recv_buf. This can only happen if the user did not set the response callback. If the callback is set, then the HTTP client API will call response callback many times so that all the data is delivered to the user. Will be zero in the event of a null response.
const struct http_parser_settings* http_response::http_cb |
HTTP parser settings for the application usage.
char http_response::http_status[HTTP_STATUS_STR_SIZE] |
See https://tools.ietf.org/html/rfc7230#section-3.1.2 for more information.
The status-code element is a 3-digit integer code
The reason-phrase element exists for the sole purpose of providing a textual description associated with the numeric status code. A client SHOULD ignore the reason-phrase content.
Will be blank if a null HTTP response is given.
uint16_t http_response::http_status_code |
Numeric HTTP status code which corresponds to the textual description.
Set to zero if null response is given. Otherwise, will be a 3-digit integer code if valid HTTP response is given.
uint8_t http_response::message_complete |
Is HTTP message parsing complete.
size_t http_response::processed |
Amount of data given to the response callback so far, including the current data given to the callback.
This should be equal to the content_length field once the entire body has been received. Will be zero if a null response is given.
uint8_t* http_response::recv_buf |
Where the response is stored, this is to be provided by the user.
size_t http_response::recv_buf_len |
Response buffer maximum length.