Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
http_request Struct Reference

HTTP client request. More...

#include <client.h>

Data Fields

struct http_client_internal_data internal
 HTTP client request internal data.
 
enum http_method method
 The HTTP method: GET, HEAD, OPTIONS, POST, ...
 
http_response_cb_t response
 User supplied callback function to call when response is received.
 
const struct http_parser_settingshttp_cb
 User supplied list of HTTP callback functions if the calling application wants to know the parsing status or the HTTP fields.
 
uint8_trecv_buf
 User supplied buffer where received data is stored.
 
size_t recv_buf_len
 Length of the user supplied receive buffer.
 
const char * url
 The URL for this request, for example: /index.html.
 
const char * protocol
 The HTTP protocol, for example "HTTP/1.1".
 
const char ** header_fields
 The HTTP header fields (application specific) The Content-Type may be specified here or in the next field.
 
const char * content_type_value
 The value of the Content-Type header field, may be NULL.
 
const char * host
 Hostname to be used in the request.
 
const char * port
 Port number to be used in the request.
 
http_payload_cb_t payload_cb
 User supplied callback function to call when payload needs to be sent.
 
const char * payload
 Payload, may be NULL.
 
size_t payload_len
 Payload length is used to calculate Content-Length.
 
http_header_cb_t optional_headers_cb
 User supplied callback function to call when optional headers need to be sent.
 
const char ** optional_headers
 A NULL terminated list of any optional headers that should be added to the HTTP request.
 

Detailed Description

HTTP client request.

This contains all the data that is needed when doing a HTTP request.

Field Documentation

◆ content_type_value

const char* http_request::content_type_value

The value of the Content-Type header field, may be NULL.

◆ header_fields

const char** http_request::header_fields

The HTTP header fields (application specific) The Content-Type may be specified here or in the next field.

Depending on your application, the Content-Type may vary, however some header fields may remain constant through the application's life cycle. This is a NULL terminated list of header fields.

◆ host

const char* http_request::host

Hostname to be used in the request.

◆ http_cb

const struct http_parser_settings* http_request::http_cb

User supplied list of HTTP callback functions if the calling application wants to know the parsing status or the HTTP fields.

This is optional and normally not needed.

◆ internal

struct http_client_internal_data http_request::internal

HTTP client request internal data.

◆ method

enum http_method http_request::method

The HTTP method: GET, HEAD, OPTIONS, POST, ...

◆ optional_headers

const char** http_request::optional_headers

A NULL terminated list of any optional headers that should be added to the HTTP request.

May be NULL. If the optional_headers_cb is specified, then this field is ignored. Note that there are two similar fields that contain headers, the header_fields above and this optional_headers. This is done like this to support Websocket use case where Websocket will use header_fields variable and any optional application specific headers will be placed into this field.

◆ optional_headers_cb

http_header_cb_t http_request::optional_headers_cb

User supplied callback function to call when optional headers need to be sent.

This can be NULL, in which case the optional_headers field in http_request is used. The idea of this optional_headers callback is to allow user to send more HTTP header data that is practical to store in allocated memory.

◆ payload

const char* http_request::payload

Payload, may be NULL.

◆ payload_cb

http_payload_cb_t http_request::payload_cb

User supplied callback function to call when payload needs to be sent.

This can be NULL in which case the payload field in http_request is used. The idea of this payload callback is to allow user to send more data that is practical to store in allocated memory.

◆ payload_len

size_t http_request::payload_len

Payload length is used to calculate Content-Length.

Set to 0 for chunked transfers.

◆ port

const char* http_request::port

Port number to be used in the request.

◆ protocol

const char* http_request::protocol

The HTTP protocol, for example "HTTP/1.1".

◆ recv_buf

uint8_t* http_request::recv_buf

User supplied buffer where received data is stored.

◆ recv_buf_len

size_t http_request::recv_buf_len

Length of the user supplied receive buffer.

◆ response

http_response_cb_t http_request::response

User supplied callback function to call when response is received.

◆ url

const char* http_request::url

The URL for this request, for example: /index.html.


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