Soletta™ Framework
|
The HTTP request interface to use when creating a new request. More...
#include <sol-http-client.h>
Data Fields | |
uint16_t | api_version |
api_version must match SOL_HTTP_REQUEST_INTERFACE_API_VERSION at runtime. More... | |
size_t | data_buffer_size |
The size in bytes of the receiving data buffer. More... | |
ssize_t(* | on_data )(void *user_data, struct sol_http_client_connection *connection, const struct sol_buffer *buffer) |
This callback is called whenever data comes. More... | |
void(* | on_response )(void *user_data, struct sol_http_client_connection *connection, struct sol_http_response *response) |
This callback is called when the request finishes, the result of request is available on response . More... | |
ssize_t(* | on_send )(void *user_data, struct sol_http_client_connection *connection, struct sol_buffer *buffer) |
This callback is called data should be written, it's commonly used for POST . More... | |
The HTTP request interface to use when creating a new request.
It allows one to have more control over the request, notifying when data comes or when data should be sent.
uint16_t sol_http_request_interface::api_version |
api_version must match SOL_HTTP_REQUEST_INTERFACE_API_VERSION at runtime.
size_t sol_http_request_interface::data_buffer_size |
The size in bytes of the receiving data buffer.
0
means unlimited buffer size (It will always grow).
ssize_t(* sol_http_request_interface::on_data)(void *user_data, struct sol_http_client_connection *connection, const struct sol_buffer *buffer) |
This callback is called whenever data comes.
The number of bytes consumed (the value returned by this callback) will be removed from buffer.
It should return the number of bytes taken care of in case of success, any negative value will abort the trasnfer.
The parameters are:
user_data
the context data given in sol_http_client_request_with_interface
connection
the connection returned in sol_http_client_request_with_interface
buffer
the data receivedvoid(* sol_http_request_interface::on_response)(void *user_data, struct sol_http_client_connection *connection, struct sol_http_response *response) |
This callback is called when the request finishes, the result of request is available on response
.
user_data
the context data given in sol_http_client_request_with_interface
connection
the connection returned in sol_http_client_request_with_interface
response
the result of the requestssize_t(* sol_http_request_interface::on_send)(void *user_data, struct sol_http_client_connection *connection, struct sol_buffer *buffer) |
This callback is called data should be written, it's commonly used for POST
.
When it's used, it's MANDATORY either the header Content-Length
with the correct size or the header Transfer-Encoding
with the value chunked on sol_http_client_request_with_interface
.
It should return the number of bytes written into buffer on success, any negative value will abort the trasnfer.
The parameters are:
user_data
the context data given in sol_http_client_request_with_interface
connection
the connection returned in sol_http_client_request_with_interface
buffer
the buffer where the data should be written, the buffer's capacity indicates the amount of data that should be set.