21 #include <sol-common-buildopts.h>
66 #ifndef SOL_NO_API_VERSION
67 #define SOL_HTTP_SERVER_CONFIG_API_VERSION (1)
190 #ifdef SOL_FEATURE_FILESYSTEM
264 const struct {
const char *k;
const char *v; } *itr, headers[] = {
265 {
"Content-Type",
"text/event-stream" },
266 {
"Connection",
"keep-alive" },
267 {
"Cache-Control",
"no-cache" },
274 for (itr = headers; itr->k != NULL; itr++) {
290 #ifndef SOL_NO_API_VERSION
291 #define SOL_HTTP_SERVER_PROGRESSIVE_CONFIG_API_VERSION (1)
int sol_http_params_add(struct sol_http_params *params, struct sol_http_param_value value)
Add a new parameter to HTTP parameters vector.
Handle for an HTTP response.
Definition: sol-http.h:248
void(* on_feed_done)(void *data, struct sol_http_progressive_response *progressive, struct sol_blob *blob, int status)
Callback used to inform that a struct sol_blob was sent.
Definition: sol-http-server.h:306
struct sol_http_server_progressive_config sol_http_server_progressive_config
Progressive server response configuration.
struct sol_http_progressive_response sol_http_progressive_response
Opaque handler used for send data progressively.
Definition: sol-http-server.h:107
int sol_http_server_get_buffer_size(struct sol_http_server *server, size_t *buf_size)
Get the request buffer's size.
int sol_http_request_get_interface_address(const struct sol_http_request *request, struct sol_network_link_addr *address)
Gets the address of the interface that request comes.
int sol_http_server_send_response(struct sol_http_request *request, struct sol_http_response *response)
Send the response to request given in the callback registered on sol_http_server_register_handler().
uint16_t port
Definition: sol-http-server.h:74
size_t feed_size
The output buffer size - 0 means unlimited data.
Definition: sol-http-server.h:330
const struct sol_cert * key
Definition: sol-http-server.h:77
int sol_http_server_set_buffer_size(struct sol_http_server *server, size_t buf_size)
Set the buffer size for a request.
struct sol_cert sol_cert
Certificate handler.
Definition: sol-certificate.h:48
enum sol_http_method sol_http_request_get_method(const struct sol_http_request *request)
Gets the method (GET, POST, ...) from a given request.
static struct sol_http_server * server
Definition: server-https.c:52
void(* on_close)(void *data, const struct sol_http_progressive_response *progressive)
Callback used to inform that the client has closed the connection.
Definition: sol-http-server.h:313
const char * sol_http_request_get_url(const struct sol_http_request *request)
Gets the URL from a given request.
static int sol_http_response_set_sse_headers(struct sol_http_response *response)
Set the necessary headers to allow server sent events.
Definition: sol-http-server.h:262
#define SOL_HTTP_REQUEST_PARAM_HEADER(header_, content_)
Macro to set a struct sol_http_param_value with type SOL_HTTP_PARAM_HEADER, a header and content...
Definition: sol-http.h:438
static struct sol_network_link_addr address
Definition: echo-client.c:44
int sol_http_server_remove_dir(struct sol_http_server *server, const char *basename, const char *rootdir)
Removes a dir registered with sol_http_server_add_dir()
void sol_http_server_del(struct sol_http_server *server)
Destroy the server instance.
struct sol_http_server_config::@2 security
Structure to represent a network address, both IPv6 and IPv4 are valid.
Definition: sol-network.h:145
int sol_http_progressive_response_sse_feed(struct sol_http_progressive_response *progressive, struct sol_blob *blob)
Send sse data for the progressive response.
void sol_http_progressive_response_del(struct sol_http_progressive_response *progressive, bool graceful_del)
Delete the progressive response.
uint16_t api_version
api_version must match SOL_HTTP_REQUEST_INTERFACE_API_VERSION at runtime.
Definition: sol-http-server.h:296
struct sol_http_server sol_http_server
Opaque handler for an HTTP server instance.
Definition: sol-http-server.h:57
int sol_http_server_register_handler(struct sol_http_server *server, const char *path, int(*request_cb)(void *data, struct sol_http_request *request), const void *data)
Register a handler for a specific path.
struct sol_http_progressive_response * sol_http_server_send_progressive_response(struct sol_http_request *request, const struct sol_http_response *response, const struct sol_http_server_progressive_config *config)
Send the response and keep connection alive to request given in the callback registered on sol_http_s...
struct sol_http_params param
Definition: sol-http.h:257
sol_http_status_code
Status codes as defined by HTTP protocol.
Definition: sol-http.h:123
const struct sol_http_params * sol_http_request_get_params(const struct sol_http_request *request)
Gets the parameters from a given request.
It's created with sol_http_server_new() and should be later deleted with sol_http_server_del() ...
Definition: sol-http-server.h:65
int sol_http_server_set_last_modified(struct sol_http_server *server, const char *path, time_t modified)
Set the last time the specified path had its value modified.
struct sol_http_server * sol_http_server_new(const struct sol_http_server_config *config)
Creates an HTTP server, binding on all interfaces in the specified port.
sol_http_method
Type of HTTP method.
Definition: sol-http.h:47
Keep vector of HTTP parameters to be sent in a request.
Definition: sol-http.h:178
Data type describing the default blob implementation.
Definition: sol-types.h:468
int sol_http_progressive_response_feed(struct sol_http_progressive_response *progressive, struct sol_blob *blob)
Send data for the progressive response.
struct sol_http_request sol_http_request
Opaque handler for a request made to an HTTP server.
Definition: sol-http-server.h:94
int sol_http_request_get_client_address(const struct sol_http_request *request, struct sol_network_link_addr *address)
Gets the client address that made the request.
const void * user_data
Definition: sol-http-server.h:314
Progressive server response configuration.
Definition: sol-http-server.h:289
int sol_http_server_unregister_handler(struct sol_http_server *server, const char *path)
Removes a handler registered with sol_http_server_register_handler()
These routines are used for Soletta's certificate handling.
static int request_cb(void *data, struct sol_http_request *request)
Definition: server-https.c:56
int sol_http_server_add_dir(struct sol_http_server *server, const char *basename, const char *rootdir)
Add a root dir where the server will look for static files to serve.
struct sol_http_server_config sol_http_server_config
It's created with sol_http_server_new() and should be later deleted with sol_http_server_del() ...
These are routines that Soletta provides for handling network link interfaces, making it possible to ...
const struct sol_cert * cert
Definition: sol-http-server.h:76