Zephyr API 3.6.99
Loading...
Searching...
No Matches
http_response Struct Reference

HTTP response from the server. More...

#include <client.h>

Data Fields

const struct http_parser_settingshttp_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_tbody_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_trecv_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.
 

Detailed Description

HTTP response from the server.

Field Documentation

◆ body_found

uint8_t http_response::body_found

Is message body found.

◆ body_frag_len

size_t http_response::body_frag_len

Length of the body fragment contained in the recv_buf.

◆ body_frag_start

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 --------------------→|
       ---------------------------------------------------------------

..header/body | body | body..

↑ recv_buf body_frag_start

body_frag_start >= recv_buf body_frag_len = data_len - (body_frag_start - recv_buf)

◆ cb

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.

◆ cl_present

uint8_t http_response::cl_present

Is Content-Length field present.

◆ content_length

size_t http_response::content_length

HTTP Content-Length field value.

Will be set to zero in the event of a null response.

◆ data_len

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.

◆ http_cb

const struct http_parser_settings* http_response::http_cb

HTTP parser settings for the application usage.

◆ http_status

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.

◆ http_status_code

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.

◆ message_complete

uint8_t http_response::message_complete

Is HTTP message parsing complete.

◆ processed

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.

◆ recv_buf

uint8_t* http_response::recv_buf

Where the response is stored, this is to be provided by the user.

◆ recv_buf_len

size_t http_response::recv_buf_len

Response buffer maximum length.


The documentation for this struct was generated from the following file: