Soletta™ Framework
|
API to perform HTTP(s) requests. More...
Data Structures | |
struct | sol_http_request_interface |
The HTTP request interface to use when creating a new request. More... | |
Typedefs | |
typedef struct sol_http_client_connection | sol_http_client_connection |
Opaque handler for an HTTP client connection. More... | |
typedef struct sol_http_request_interface | sol_http_request_interface |
The HTTP request interface to use when creating a new request. More... | |
Functions | |
void | sol_http_client_connection_cancel (struct sol_http_client_connection *pending) |
Cancel a pending request and release its resources. More... | |
struct sol_http_client_connection * | sol_http_client_request (enum sol_http_method method, const char *url, const struct sol_http_params *params, void(*cb)(void *data, struct sol_http_client_connection *connection, struct sol_http_response *response), const void *data) |
Create a request for the specified URL using the given method. More... | |
struct sol_http_client_connection * | sol_http_client_request_with_interface (enum sol_http_method method, const char *url, const struct sol_http_params *params, const struct sol_http_request_interface *interface, const void *data) |
Create a request for the specified URL using the given method. More... | |
API to perform HTTP(s) requests.
It will buffer whole responses in memory, so it's more suitable to perform remote API calls than file transfers.
Opaque handler for an HTTP client connection.
It's created when a request is made with sol_http_client_request() or sol_http_client_request_with_interface().
A connection may be canceled with sol_http_client_connection_cancel().
typedef struct sol_http_request_interface sol_http_request_interface |
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.
void sol_http_client_connection_cancel | ( | struct sol_http_client_connection * | pending | ) |
Cancel a pending request and release its resources.
pending | the object previously created with sol_http_client_request(). |
Referenced by shutdown().
struct sol_http_client_connection* sol_http_client_request | ( | enum sol_http_method | method, |
const char * | url, | ||
const struct sol_http_params * | params, | ||
void(*)(void *data, struct sol_http_client_connection *connection, struct sol_http_response *response) | cb, | ||
const void * | data | ||
) |
Create a request for the specified URL using the given method.
The result of the request is obtained in cb
.
One should check the response code on sol_http_response
to check if the request returned success or some error.
method | a valid HTTP method, e. g. SOL_HTTP_METHOD_GET or SOL_HTTP_METHOD_POST |
url | a string containing a valid URL. |
params | the parameters used on this request, e. g. headers, cookies and post fields. |
cb | callback that will be called with the response for this request. |
data | user data given as parameter on cb |
NULL
on error.Referenced by startup().
struct sol_http_client_connection* sol_http_client_request_with_interface | ( | enum sol_http_method | method, |
const char * | url, | ||
const struct sol_http_params * | params, | ||
const struct sol_http_request_interface * | interface, | ||
const void * | data | ||
) |
Create a request for the specified URL using the given method.
The result of the request is obtained in cb
.
One should check the response code on sol_http_response
to check if the request returned success or some error.
method | a valid HTTP method, e. g. SOL_HTTP_METHOD_GET or SOL_HTTP_METHOD_POST |
url | a string containing a valid URL. |
params | the parameters used on this request, e. g. headers, cookies and post fields. |
interface | the interface with the callbacks used in the request. |
data | user data given as parameter on cb |
NULL
on error.Referenced by startup().