summaryrefslogtreecommitdiffhomepage
path: root/https.h
blob: 864f37996b857805fd4911ea103c6ffbd82e65cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once

#include <boost/beast/version.hpp>

// Support both boost in Debian unstable (BOOST_LATEST) and in stable (boost 1.67)
#if BOOST_VERSION >= 107100
#define BOOST_LATEST
#endif

#include <memory>
#include <string>
#include <unordered_map>

#include <boost/asio/dispatch.hpp>
#include <boost/asio/strand.hpp>
#ifdef BOOST_LATEST
#include <boost/beast/ssl.hpp>
#endif
#include <boost/asio/ssl.hpp>

#include "config.h"
#include "server.h"

namespace ssl = boost::asio::ssl;       // from <boost/asio/ssl.hpp>

namespace HTTPS {

#ifdef BOOST_LATEST
static const ssl::context_base::method tls_method {ssl::context::tlsv13};
#else
static const ssl::context_base::method tls_method {ssl::context::tlsv12};
#endif

class Server: public ::Server
{
public:
 typedef std::unordered_map<std::string, std::shared_ptr<ssl::context>> ctx_type;

private:
 ctx_type m_ctx;
 
public:
 Server(Config& config, boost::asio::io_context& ioc, const Socket& socket, plugins_container_type& plugins);
 virtual ~Server();

 int start() override;
};

}