Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
server-https.c File Reference

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_certcert
 
static struct sol_certkey
 
static struct sol_http_serverserver
 
static char * server_data
 

Detailed Description

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.

Function Documentation

static int request_cb ( void *  data,
struct sol_http_request request 
)
static
static void shutdown_server ( void  )
static
SOL_MAIN_DEFAULT ( startup_server  ,
shutdown_server   
)
static void startup_server ( void  )
static

Variable Documentation

struct sol_cert* cert
static
struct sol_cert * key
static
struct sol_http_server* server
static
char* server_data
static