Soletta™ Framework
|
HTTPS sample. More...
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include "soletta.h"
#include "sol-http.h"
#include "sol-http-server.h"
Functions | |
static int | request_cb (void *data, struct sol_http_request *request) |
static void | shutdown_server (void) |
SOL_MAIN_DEFAULT (startup_server, shutdown_server) | |
static void | startup_server (void) |
Variables | |
static struct sol_cert * | cert |
static struct sol_cert * | key |
static struct sol_http_server * | server |
static char * | server_data |
HTTPS sample.
Basic HTTPS server. It uses a given certificate to crypto its contents.
How to generate a certificate:
openssl req -new > new.cert.csr openssl rsa -in privkey.pem -out new.cert.key openssl x509 -in new.cert.csr -out new.cert.cert -req -signkey new.cert.key -days 3652 -sha1
To test it:
run ./server-https -p 8080 -d "Hello HTTPS" -c new.cert.cert -k new,.cert.key
open the browser and go to address https://your-ip:the-given-port The browser will complaint about the certificate, it's ok add it as exception.
To see the usage help, -h or –help.
|
static |
References sol_http_response::api_version, sol_http_response::content, server_data, sol_buffer_fini(), SOL_BUFFER_INIT_CONST, SOL_HTTP_REQUEST_PARAMS_INIT, SOL_HTTP_RESPONSE_API_VERSION, sol_http_server_send_response(), SOL_HTTP_STATUS_OK, and SOL_SET_API_VERSION.
Referenced by startup_server().
|
static |
SOL_MAIN_DEFAULT | ( | startup_server | , |
shutdown_server | |||
) |
|
static |
References cert, key, port, request_cb(), server, server_data, sol_argc(), sol_argv(), sol_cert_load_from_id(), sol_cert_unref(), SOL_HTTP_SERVER_CONFIG_API_VERSION, sol_http_server_new(), sol_http_server_register_handler(), sol_quit_with_code(), and SOL_SET_API_VERSION.
|
static |
Referenced by startup_server().
|
static |
|
static |
Referenced by main(), shutdown_server(), startup_server(), and update_light().
|
static |
Referenced by main(), request_cb(), and startup_server().