Portable HTTP/1.1 client for REST APIs.
More...
|
| int | ove_http_client_init (ove_http_client_t *client, ove_http_client_storage_t *storage) |
| | Initialise an HTTP client from caller-supplied storage.
|
| |
| void | ove_http_client_deinit (ove_http_client_t client) |
| | De-initialise an HTTP client.
|
| |
| int | ove_http_get (ove_http_client_t client, const char *url, ove_http_response_t *resp) |
| | Perform an HTTP GET request.
|
| |
| int | ove_http_post (ove_http_client_t client, const char *url, const char *content_type, const void *body, size_t body_len, ove_http_response_t *resp) |
| | Perform an HTTP POST request.
|
| |
| int | ove_http_request (ove_http_client_t client, ove_http_method_t method, const char *url, const char *content_type, const void *body, size_t body_len, ove_http_response_t *resp) |
| | Perform a generic HTTP request.
|
| |
| int | ove_http_request_ex (ove_http_client_t client, ove_http_method_t method, const char *url, const char *content_type, const void *body, size_t body_len, const ove_http_header_t *headers, size_t header_count, ove_http_response_t *resp) |
| | Perform an HTTP request with custom headers.
|
| |
| void | ove_http_response_free (ove_http_response_t *resp) |
| | Free resources in an HTTP response.
|
| |
| int | ove_http_client_create (ove_http_client_t *client) |
| | Heap-allocate and initialise an HTTP client.
|
| |
| void | ove_http_client_destroy (ove_http_client_t client) |
| | Destroy a heap-allocated HTTP client.
|
| |
Portable HTTP/1.1 client for REST APIs.
Supports GET and POST with optional TLS (when OVE_NET_TLS is enabled). The client is portable C and delegates I/O to the socket/TLS layers.
- Note
- Requires
CONFIG_OVE_NET_HTTP (implies CONFIG_OVE_NET). When disabled every function is replaced by a no-op stub.
◆ ove_http_method_t
HTTP method.
| Enumerator |
|---|
| OVE_HTTP_GET | HTTP GET.
|
| OVE_HTTP_POST | HTTP POST.
|
| OVE_HTTP_PUT | HTTP PUT.
|
| OVE_HTTP_DELETE | HTTP DELETE.
|
| OVE_HTTP_PATCH | HTTP PATCH.
|
◆ ove_http_client_init()
| int ove_http_client_init |
( |
ove_http_client_t * |
client, |
|
|
ove_http_client_storage_t * |
storage |
|
) |
| |
Initialise an HTTP client from caller-supplied storage.
- Parameters
-
| [out] | client | Handle written on success. |
| [in] | storage | Caller-allocated storage. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_client_deinit()
De-initialise an HTTP client.
- Parameters
-
◆ ove_http_get()
Perform an HTTP GET request.
- Parameters
-
| [in] | client | HTTP client handle. |
| [in] | url | Full URL (e.g. "http://example.com/path"). |
| [out] | resp | Response filled on success. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_post()
Perform an HTTP POST request.
- Parameters
-
| [in] | client | HTTP client handle. |
| [in] | url | Full URL. |
| [in] | content_type | Content-Type header value (e.g. "application/json"). |
| [in] | body | Request body data. |
| [in] | body_len | Request body length in bytes. |
| [out] | resp | Response filled on success. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_request()
Perform a generic HTTP request.
- Parameters
-
| [in] | client | HTTP client handle. |
| [in] | method | HTTP method. |
| [in] | url | Full URL. |
| [in] | content_type | Content-Type (may be NULL for GET). |
| [in] | body | Request body (may be NULL). |
| [in] | body_len | Request body length. |
| [out] | resp | Response filled on success. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_request_ex()
Perform an HTTP request with custom headers.
- Parameters
-
| [in] | client | HTTP client handle. |
| [in] | method | HTTP method (GET, POST, PUT, DELETE, PATCH). |
| [in] | url | Full URL. |
| [in] | content_type | Content-Type (may be NULL). |
| [in] | body | Request body (may be NULL). |
| [in] | body_len | Request body length. |
| [in] | headers | Array of extra request headers (may be NULL). |
| [in] | header_count | Number of headers in the array. |
| [out] | resp | Response filled on success. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_response_free()
Free resources in an HTTP response.
- Parameters
-
| [in] | resp | Response to free (body and headers are freed). |
◆ ove_http_client_create()
Heap-allocate and initialise an HTTP client.
- Parameters
-
| [out] | client | Handle written on success. |
- Returns
- OVE_OK on success, negative error code on failure.
◆ ove_http_client_destroy()
Destroy a heap-allocated HTTP client.
- Parameters
-